How to hide the command window of a custom action?

ImportantThe following article uses options that are available starting with the Professional edition and project type.

Most installations use custom actions for features that are not supported by Windows Installer or by Advanced Installer. Some of these actions show a command window with their status when launched. In order to hide this window, you can use several solution.

I. You can use a Launch file custom action by simply checking its "Hide program's window" flag.

II. As another solution special function from an Advanced Installer DLL. To launch an EXE with its command window hidden, you can try following these steps:

  1. add the EXE file in the Files and Folders page as a regular or temporary file
  2. in the Custom Actions page, create a Launch attached file custom action
  3. when prompted about a file, use aicustact.dll from the "custact\x86" sub-folder of the Advanced Installer installation folder (usually it's "C:\Program Files\Caphyon\Advanced Installer")
  4. in the Custom Action Properties page set the Function Name combo to CreateExeProcess
  5. set the Action Data field to the full path of the EXE you want to launch (you can use the [ ... ] in the field to select it)

For example, the Action Data field can be set to something like this for regular files:

[#MyFile.exe]

or to something like this for temporary files:

[&MyFile.exe]

If the custom action needs a custom working directory, it can be specified before the EXE path followed by the > character. For example:

[APPDIR]>[#MyFile.exe]

or:

[APPDIR]>[&MyFile.exe]

TipTo hide the command window of a .BAT file (e.g. MyBAT.bat), you can use the following line of code in a .VBS custom action which launches the .BAT file:

createobject("WScript.Shell").run "MyBAT.bat", false