This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- LaunchAppAndWait with CMD and batch file
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Sep 19, 2012
08:04 AM
LaunchAppAndWait with CMD and batch file
I am trying to execute a batch file after install using LaunchAppAndWait. The batch file is in the installation directory and references files within the install directory. However, when CMD starts it starts in the System directory, either System32 or SysWOW64 depending on the OS.
I have tried setting ChangeDirectory(sInstallDir); however, that has not worked.
According to the help documentation the option, LAAW_OPTION_NO_CHANGEDIRECTORY is obsolete.
What I would like to do is start the CMD window so that it is directory is INSTALLDIR. Then execute the batch file.
For some reason I thought that I could stack commands in the parameters and I tried to stack cd sInstallDir sBatchFile, but that did not work either.
Any ideas?
I have tried setting ChangeDirectory(sInstallDir); however, that has not worked.
According to the help documentation the option, LAAW_OPTION_NO_CHANGEDIRECTORY is obsolete.
What I would like to do is start the CMD window so that it is directory is INSTALLDIR. Then execute the batch file.
For some reason I thought that I could stack commands in the parameters and I tried to stack cd sInstallDir sBatchFile, but that did not work either.
Any ideas?
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Sep 19, 2012
09:01 AM
I figured out how to stack commands to the command interpreter.
I needed to pass in the commands with an ampersand separator.
example:
I needed to pass in the commands with an ampersand separator.
example:
cmdopt = "/C " + "cd " + sInstallDir + "&" + sFilePathName;
SprintfMsiLog("INFORMATION: Attempting to execute Registeritall.bat. CMD: %s, PARAM: %s.", cmdExecute, cmdopt);
nResult = LaunchAppAndWait(cmdExecute, cmdopt, LAAW_OPTION_WAIT);
if nResult != ERROR_SUCCESS then
SprintfMsiLog("ERROR: Failed to execute Registeritall.bat. Return value: %d", nResult);
endif;
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)