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
Any help would be great!
Ian
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.lpCurrentD irectory = &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.lpCurrentD irectory = &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
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.lpCurrentD
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.lpCurrentD
szProgram = TARGETDIR ^ "MyProgram.exe";
LongPathToQuote(szProgram,
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.
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.
Regards,
Rob.
Open in new window