cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Running a Batch File from Your Setup

Running a Batch File from Your Setup

Summary

This article discusses how to launch a .bat file from a setup with Installscript.

Synopsis

This article discusses how to launch a .bat file from a setup with Installscript. The article applies to Basic MSI, InstallScript and InstallScript MSI Project Types.


Discussion

A batch file can be launched much like a standard executable file. The InstallScript functions LaunchApp or LaunchAppAndWait or, beginning with InstallShield 2008, LaunchApplication can be used, and the batch file would be passed as the first parameter. An advantage of the LaunchApplication InstallScript function is that it provides additional parameters and, thus, more control; whereas, LaunchAppAndWait calls LaunchApplication internally with certain default parameters, such as LAAW_OPTION_WAIT, specified automatically.

For example, the LaunchApplication InstallScript function would allow the setup author to hide the window of the spawned process (i.e. hide the command prompt window when launching a batch file). An example of how launching a batch file might look in InstallScript is as follows:

szProgram = "E:\\example.bat";
szCmdline = "";
LaunchApp (szProgram,szCmdline);


Additional Information

For Basic MSI projects, the InstallScript would need to be called through an InstallScript Custom Action.

For more information on the LaunchApp function please reference the following HelpNet Article: LaunchApp

For an example on the LaunchApp function please reference the following HelpNet Article: LaunchApp Example

Related KB Articles

Q111515
Was this article helpful? Yes No
No ratings
Comments

i wanted to execute a batch script using installscript. but i am getting an error 

szProgram - undefined identifier

szCmdline-undefined identifier

szCmdline-string value required

Here is what i tried to execute inside the fucntion:-

szProgram = "C:\Users\rr9\Desktop\Bat files\creating a directory.bat";
szCmdline = "";
LaunchApp (szProgram,szCmdline);

szProgram - undefined identifier

Version history
Last update:
‎Nov 07, 2007 06:33 PM
Updated by: