- Revenera Community
- :
- InstallShield
- :
- InstallShield Knowledge Base
- :
- HOW TO: Launch a bat file from INSTALLDIR/SUPPORTDIR using Custom Action
- Mark as New
- Mark as Read
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
HOW TO: Launch a bat file from INSTALLDIR/SUPPORTDIR using Custom Action
HOW TO: Launch a bat file from INSTALLDIR/SUPPORTDIR using Custom Action
Introduction
This article will discuss one possible method of Launching a batch file using a custom action.
Instructions
Method:1 Launching from INSTALLDIR
- Create a Project and Add your batch file in Files and Folder[INSTALLDIR]
- Create a New EXE Custom Action [ Type: New EXE , Path referencing a directory]
- Set the Working Directory: SystemFolder
- File Name and Command Line: cmd.exe /c "[INSTALLDIR]test.bat"
- Return Processing: Synchronous (Check Exit code)
- In-Script Execution: Immediate Execution
- Set the Install Exec Sequence "After InstallFinalize"
- Add a condition if you want to run this action only on installation EX: Not Installed
Method:2 Launching from SUPPORTDIR
- Create a Project and Add your batch file to Behavior And Logic Supportfiles --> Language Independent
- Create a New EXE Custom Action [ Type: New EXE , Path referencing a directory]
- Set the Working Directory: SystemFolder
- File Name and Command Line: "[SystemFolder]cmd.exe" /c "[SUPPORTDIR]\test.bat"
- Return Processing: Synchronous (Check Exit code)
- In-Script Execution: Deferred Execution in System Context
- Set the Install Exec Sequence "After InstallFinalize" or "After InstallFiles"
- Add a condition if you want to run this action only on installation EX: Not Installed
More Information
Click here for details on how to launch batch file using installscript .
Additional Information:
"[SystemFolder]cmd.exe /c "[INSTALLDIR]test.bat"
This command calls cmd.exe (the executable for the Windows command prompt) from the location stored in the SystemFolder MSI property and passes cmd.exe the path to the batch file. Cmd.exe accepts various parameters. For example, to have the command prompt window close after launching the batch file, use the /c parameter, as in the example above. To have the command prompt window remain open after launching the batch file, use the /k parameter instead.
For more information regarding the parameters accepted by cmd.exe, click here cmd exe