Passing command line values to EDX Setup

From time to time it can be valuable to get information about what's happening during the installation process. To enable such features:

Setup.exe

InstallShield 2011 Express Edition

Like your compiled .msi file, Setup.exe can accept a limited number of command-line parameters. By using these parameters, you can specify which language you want your installation to run in and if you want Setup.exe to run silently. You can also pass parameters through Setup.exe to the included .msi file.

Setup.exe accepts the following command-line options, each of which is described below:

  • /v : Pass command-line parameters to the .msi package

  • /s : Silent

  • /p : Password mode

  • /a : Administrative installation

  • /j : Advertise mode

  • /x : Uninstall mode

  • /f : Repair mode

  • /ua : Install Windows 9x MSI Engine

  • /uw : Install Windows NT MSI Engine

  • /b : Cache installation locally

  • /debuglog : Generate a log file for debugging

  • /w : Wait

Passing Parameters to the .msi File Within Setup.exe

If you include Setup.exe as part of your installation, you may need to pass command-line parameters to the .msi package stored within Setup.exe. To pass arguments to the .msi file, use the /v option. Once you specify this option, you can list any of the supported parameters that can be passed to Msiexec.exe. For example, to create a verbose log of the installation, enter the following:

 

Setup.exe /v"/l*v \"c:\My Log Files\test.log\""

 

There are a few special formatting rules that you need to follow when passing a parameter in this way. First, you need to place a backslash (\) in front of any quotation mark that resides within existing quotes. For example, the command line above contains the following: v"/l*v \"c:\My Log Files\test.log\". Because the path to the log file is a long path, you need to use quotes. However, since you need to have quotes around the complete argument, the command-line statement fails if you do not use the backslash in front of all internal quotes.

 

Another formatting rule dictates that there cannot be a space between the command-line option (/v) and the arguments that you are passing, as illustrated in the example above.

 

In addition, if you are passing multiple parameters using the /v option, you need to separate them with a space—for example:

 

Setup.exe /v"/l*v \"c:\My Log Files\test.log\" /qn"

 

This command creates a log file and runs the installation silently.

 

As an alternative, you can use the /v option multiple times at the command line, once for each argument, as in the following example:

 

Setup.exe /v"/l*v \"c:\My Log Files\test.log\"" /v"/qn"

 

Running Setup.exe Silently

If you do not want the Setup.exe file to display a progress bar when it launches, you can use the /s command-line parameter. For example, if you enter the following command-line statement, Setup.exe launches, but the user interface is not displayed:

 

Setup.exe /s

 

If you want the .msi setup to run silently as well, you need to pass the /qn command-line parameter through Setup.exe using the /v parameter—for example:

 

Setup.exe /s /v/an

If your installation is password protected, you must also pass the /p parameter.

 

Specifying a Password from the Command Line

You can specify a password for a password-protected setup by using the /p parameter. If you run a password-protected setup in silent mode, you must specify the password from the command line or the installation will fail.

 

To run a password-protected setup silently, enter the following statement at the command line:

 

Setup.exe /s /v/qn /p"password"

 

Specifying the Installation Mode from the Command Line

 

You can define what mode you want your installation to run in by using the /a (Administrative), /j (Advertise), /x (Uninstall), or /f (Repair) parameters. Each of these options is explained in detail below.

 

Administrative

 

When you run an installation in administrative mode, you can install an installation image to the network, which allows any one with access to that directory the ability to install that installation on their local machine with the privileges of the administrator who ran the administrative installation. No additional parameters are necessary for this option.

 

Advertise

 

Advertisement is a type of “just-in-time” installation in which features are installed when they are requested from the installer and not installed immediately during installation. When you launch MsiExec.exe with the /j  option, the features are advertised on the end user’s system, but not immediately installed. In most cases, the end user has the option to advertise features in the Custom Setup dialog. For information on the proper syntax for this parameter, seeCommand-Line Options in the Windows Installer Help Library.

 

Uninstall

 

If you want to uninstall your installation from the command line without displaying the maintenance dialogs, you need to use the /x option—for example:

 

Setup.exe /v/x

 

No additional parameters are required.

 

Repair

 

When you launch an installation in repair mode, it makes sure that all portable executable (.exe, .com, .ocx, .tlb) and help (.chm and .hlp) files are present and uncorrupted. If the installation detects that one of these files is missing or corrupt, it attempts to repair the file. To launch an installation in repair mode from the command line, use the /f option. For information on the proper syntax for this parameter, see MsiExec.exe.

 

Specifying the Windows Installer Engine Location from the Command Line

 

From the command line, you can specify the location of the Windows Installer engine to download for Web-deployable installations. To do so, use the following syntax.

 

Windows 9x MSI Engine

 

Setup.exe /ua"InstallShield "

 

Windows NT MSI Engine

 

Setup.exe /uw"InstallShield "

 

Specifying Cache Location

 

To enable advanced Windows Installer functionality, such as feature advertisement and application repair, you can copy the installation to a location on the target machine. To do so, use the following syntax, including a fully qualified path:

 

Setup.exe /b"C:\Storage\MyCachedPrograms\"

The installation will be cached at a subdirectory of the location specified. This subdirectory is named after the Package Code GUID of the installation. If there is a problem unpacking to that location, the installation will ask for an alternate location.

 

This option can only be used for SingleImage, Custom, and WebDeployment builds.

 

Generate a Log File for Debugging

 

The /debuglog parameter lets you generate a log file for Setup.exe.

 

To generate a log named InstallShield.log in the same directory as the Setup.exe file, pass just the command-line parameter. Note that this does not work if the Setup.exe file is in a read-only location. For example:

 

Setup.exe /debuglog

 

To specify the name and location of the log file, pass the path and name, as in the following example:

 

Setup.exe /debuglog"C:\PathToLog\setupexe.log"

 

Requiring Setup.exe to Wait

 

Use the /w command line option to have Setup.exe wait until MsiExec.exe is finished before Setup.exe exits. In addition, the /w command also returns any return codes generated by MsiExec.exe.

 

If you are using the /w option in a batch file, you may want to precede the entire Setup.exe command-line argument with start /WAIT. A properly formatted example of this usage is as follows:

 

start /WAIT setup.exe /w

Still need help?

Contact us through our support portal!