Summary
This article describes how to launch a batch file from a Windows Installer (MSI-based) setup.
Discussion
The following steps describe how to create a custom action that launches a batch file targeted to be installed to the main installation directory location (i.e., the location stored in the INSTALLDIR MSI property).
To create a custom action that launches a batch file targeted to be installed to the main installation directory location:
- Make sure that the installer is configured to install the batch file to the main installation directory location (i.e., the location stored in the
INSTALLDIR MSIproperty) - Launch the Custom Action Wizard. For more information, see the Additional Information section of this article.
- On the Basic Information dialog, enter a name (such as test) for the custom action in the Name field.
- Click the Next button.
- On the Action Type dialog, set the Type to Launch an executable and the Location to Stored in the Directory Table.
- Click the Next button.
- On the Action Parameters dialog, set the Source to SystemFolder and the Target to the following:
"[SystemFolder]cmd.exe" /c "[INSTALLDIR]NameOfBatchFile.bat"This command calls
cmd.exe(the executable for the Windows command prompt) from the location stored in theSystemFolderMSI property and passescmd.exethe path to the batch file.Cmd.exeaccepts various parameters. For example:- To have the command prompt window close after launching the batch file, use the
/cparameter, as in the example above. - To have the command prompt window remain open after launching the batch file, use the
/kparameter instead. - For more information regarding the parameters accepted by
/cmd.exe, see the Additional Information section of this article.
- To have the command prompt window close after launching the batch file, use the
- Click the Next button.
- On the Additional Options dialog, keep the default values selected.
- Click the Next button.
- On the Respond Options dialog, keep the default values selected.
- Click the Next button.
- On the Insert into Sequence dialog, set the Install Execute Sequence to After InstallFinalize and the Install Execute Condition to the following: Not Installed and VersionNT. This condition instructs the install to only execute the custom action during a first-time install on an NT-based target system.
Additional Information
- This method is restricted to NT systems.
- For more information about the Microsoft
cmd.execommand interpreter, refer to the Microsoft Learn article: Cmd. - For more information on the VersionNT property, refer to the Microsoft Learn article: VersionNT Property.
- For more information on creating custom actions in InstallShield, see Custom Action Wizard in the InstallShield Help Library.
Related Articles
Launching a Batch File in Express 4Number of Views Launching a Batch File in Express 3Number of Views Running a Batch File from Your Setup 14Number of Views How to install lmgrd as service on Windows platfrom from a batch file or program? 3Number of Views HOW TO: Launch a bat file from INSTALLDIR/SUPPORTDIR using Custom Action 24Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago