Link to home
Start Free TrialLog in
Avatar of jjumpm2
jjumpm2

asked on

How do I run a command from Installshield?

I need to run a command after installshield has finished installing our software, is this possible? If not, how do I launch a program, for instance a batch file?


Any help would be great!



Ian
Avatar of RobSampson
RobSampson
Flag of Australia image

Hi, if you run the setup task waiting for completion, the next line in the batch file would only execute once it is finished....something like this....

Regards,

Rob.
@echo off
start /wait c:\software\Setup.exe /qn
C:\Software\BatchToRun.bat

Open in new window

Avatar of jjumpm2
jjumpm2

ASKER

Hi,

Thank you for your reply. I will try and make it clearer what I am trying to do..

I have a Installshield project that installs our software. After it has installed the files, I need it to run a command (like you would from the start menu using "Run"). If this is not possible, I could also do it using a batch file, so I would need the installer to run that after the install has finished..


Ian
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you have an InstallScript based Setup you can use the built-in LaunchAppAndWait function to launch an external program via InstallScript code.
Make sure that you set the current directory to a path that actualy exists on the target computer before calling the LaunchAppAndWait function, for example:
szCurrent = WINSYSDIR;
LAAW_PARAMETERS.lpCurrentDirectory = &szCurrent;
LaunchAppAndWait ( szProgram, szCmdLine, nOptions );

In case you need to run a program with multiple command line parameters it's a good idea to use cmd.exe as szProgram, and to specify the executable in szCmdLine:
szCurrent = TARGETDIR;
LAAW_PARAMETERS.lpCurrentDirectory = &szCurrent;
szProgram = TARGETDIR ^ "MyProgram.exe";
LongPathToQuote(szProgram, TRUE);
szCmdLine = "\"" + szProgram + " -param1 -param2\""
nResult = LaunchAppAndWait ( "cmd.exe /c", szCmdLine, nOptions );

You can even customize the _LaunchAppEx InstallScript function by using the version available at http://www.installsite.org:
http://www.installsite.org/files/LaunchAppEx.zip
If you are using Installshield to edit your setup project file, you can simply navigate into the custom actions tab. There you will find all kinds of custom actions to run, like:
new vb script, new exe, new dll
I recommend using new exe since you only need to execute a setup commmand, and depending on the command line, you have more options to select.

If you are using install shield and cannot find this easily, I can upload a screenshot.