Jump to content

.cmd files and WPI


Recommended Posts

Hello !

First excuse my bad frenchy english ...

I've got a problem with WPI when I try to install programs with the help of .cmd files.... sometime it helps to make some install.cmd...

So when windows execute the runonceex commands, I've got a path problem inside all my install.cmd : Windows find the install.cmd files, but it seems that they are executed from c:\, and so i can't find the files that are run INSIDE the install.cmd ...

Anybody has an idea ?

Thanks !

Link to comment
Share on other sites


In the cdrom/wpi/Install folder, I have few program folders... And in some of theses folders, I have setup.exe, and in others I have install.cmd, beacause I need to execute lots of commands to install the program...

In an install.cmd I can have some commands like :

setup.exe /verisilent

copy xxx c:\xxx\xxx

unrar xx.rar

And the problem is that when you lauch a .cmd file from WPI, it is executed as if it was launched from c:\ and not from its folder !

So I have errors lire "cannot find setup.exe, cannot copy xxx, unrar cannot find xxx.rar ..."

What is strange is that I'm sure I was doing the same with WPI 3 and I did not have this king of problem

Link to comment
Share on other sites

One fix is you could add this to the begining of each cmd file.

REM Example, how to look for CDROM-drive. Must have WPI.ico at the root of the CD.
for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\wpi.ico set CDROM=%%i:
echo Found CD-Rom as drive %CDROM%

REM Determine the WPI startup path.
REM if wpi should run off the cd the replace %~dp0 with %cdrom%.
set installpath=%cdrom%/wpi/Install/

Rem Program commands to run
start /wait %installpath%\program\setup.exe /verisilent
start /wait %installpath%\program\reg.cmd
start /wait %installpath%\program\cleanup.cmd

:end

Try this and see if it works.

Link to comment
Share on other sites

Even easier is to add ".\" before an executable...like so:

start /wait .\setup.exe /S

What that does is it tells the batch file to look in the current directory...so if you have your batch file and the actual program in the same folder, that's the way to go. This is really helpful when you are running an SFX, where it's always extracted to a temp folder...as long as the file is in the same dir as the script, you'll be okay.

If you have folders seperating the files, then add the rest from where the script is starting from. So if the exe you want to call is located in a folder called "Files" then you would use this syntax:

start /wait .\Files\setup.exe

Make sense?

Edited by InTheWayBoy
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...