How Silent Installations Work (InstallShield)

来源:互联网 发布:android 淘宝下拉刷新 编辑:程序博客网 时间:2024/06/11 22:04
 A normal (non-silent) installation receives the necessary input from the user in the form of responses to dialog boxes. However, a silent installation does not prompt the user for input and must get its user input from a different source. That source is the InstallShield Silent Response File (.iss file). A response file contains information similar to that which an end user would enter as responses to dialog boxes when running a normal setup. InstallShield reads the necessary input from the response file at run time while performing a silent installation.
The format of a response file resembles that of an .ini file, but response files have .iss extensions. A response file is a plain text file consisting of sections containing data entries. 
The InstallShield installations can be invoked with the-s
   
parameter to run silently. 

How to Create the Response File (.iss)

Here is an example of how to create the response file:
  1. Download the Setup.exe installation bundle.
  2. Run the installation with the additional flags -a -r -f1"<path><filename.iss>", where path is the path to filename.iss and filename.iss is the name you want to use for your setup.iss file. For example:
    Setup.exe -a -r -f1"C:\setup.iss"
    Note that there is no space between -f1 and "<path><filename.iss>"
  3. Go through the install dialogs as normal, selecting the options that you want to be used in subsequent silent installs.
InstallShield will record all of your installation choices in your setup.iss file. This response file can be used later for the silent installation.
Here is an example of a response file:
[InstallShield Silent]
Version=v5.00.000
File=Response File
[DlgOrder]
Dlg0=SdLicense-0
Count=2
Dlg1=SdAskDestPath-0
[SdLicense-0]
Result=1
[SdAskDestPath-0]
szDir=C: \Program Files\AppName
Result=1
[Application]
Name= AppName
Version=1.4
Company=AppCompany

Running InstallShield in Silent Mode



After you have created the response file, you are ready to run the installation in silent mode using InstallShield Silent. When running an installation in silent mode, be aware that no messages are displayed. Instead, you can request creation of a log file, which will record installation information, including if the installation was successful. You can review the log file to determine the result of the installation.
To launch InstallShield Silent, run your Setup.exe install bundle with the flags -s -a -s -f1"<path><filename.iss>", where path is the path to filename.iss and filename.iss is the name of your setup.iss file. If you want to register Plug-in with Internet Explorer and/or Netscape 6, include the -iexplorer and/or -netscape6 options in the command line. They can be in any order but must come after the -a and before the second -s. For example,
Setup.exe -s -a -iexplorer -netscape6 -s -f1"<path><filename.iss>"
Note that there is no space between -f1 and <path><filename.iss>.
If you are doing this from an MS-DOS shell, you may find it convenient to use the "start /w" command, as that will cause MS-DOS to wait until the install is complete. For example:
Start /w Setup.exe -s -a -s -f1"C:\setup.iss"

Creating a Log File

If you want to create a log file describing the installation, use the additional flag -f2"<path><filename.log>". This will cause the log to be written to the filename.log file. For example:
Start /w Setup.exe -s -a -s -f1"C:\setup.iss" -f2"C:\setup.log"
Note that there should be no space between -f2 and "<path><filename.log>"
To verify if a silent installation succeeded, look at the ResultCode value in the [ResponseResult] section of setup.log. InstallShield writes an appropriate return value after the ResultCode keyname.


InstallShield Commands



Those setup.exe files generated with InstallShield inherently support the creation and use of answer files that may be used to silent install applications. Although it has no logic to handle anything not expected by the answer file (more or less dialogs, more or less options in a dialog) it can be a helpful means of installation for some applications. The supported switches are as follows:

-d

Runs setup in debug mode. The -d switch also includes a [pathonly] option for specifying the path of the Setup.rul file. For more information, refer to the Visual Debugger help file.

-f[path\CompiledScript]

Specifies an alternate compiled script. Unless the compiled script (.ins file) also resides in the same directory as that of Setup.exe, the full path to the compiled script must be specified. _setup.dll must also reside in the same directory as yours .ins file. For example, setup -ftest.ins will launch setup using Test.ins instead of Setup.ins.

-f1 [path\ResponseFile]

Specifies an alternate location and name of the response file (.iss file). If this option is used when running InstallShield Silent, the response file is read from the folder/file specified by[path\ResponseFile]. If this option is used along with the -r option, the response file is written to the folder/file specified by[path\ResponseFile]. If an alternate compiled script is specified using the -f switch, the -f1 switch entry must follow the -f switch entry.

-f2[path\LogFile]

Specifies an alternate location and name of the log file created by InstallShield Silent. By default, Setup.log log file is created and stored in the same directory as that of Setup.ins. If an alternate compiled script is specified using the -f switch, the -f2 switch entry must follow the -f switch entry.

-m [filename]

Causes Setup.exe to generate a Management Information Format (.mif) file automatically at the end of the setup. Do not include a path - the .mif file is always placed in the Windows folder. [Filename] is optional. If you do not specify a filename, the resulting file will be called Status.mif.

-m1 [serial number]

Tells setup to place the indicated serial number in the created .mif file.

-m2 [locale string]

Tells setup to place the indicated locale in the .mif file. English (ENU) is the default; refer to Microsoft documentation for a complete listing of locale strings.

-r

Causes Setup.exe automatically to generate a silent setup file (.iss file), which is a record of the setup input, in the Windows folder.

-s

Runs InstallShield Silent to execute a silent setup.

-SMS

Prevents a network connection and Setup.exe from closing before the setup is complete. This switch works with setups originating from a Windows NT server over a network. Please note that SMS must be uppercase; this is a case-sensitive switch.

-z

Prevents Setup.exe from checking the available memory during initialization. This switch is necessary when running a setup on a machine with more than 256 MB of memory; if it is not used, Setup.exe reports insufficient memory and exits.

-uninst

Runs the setup as an uninstallation without reading the script.

-verbose

Provides more detailed information when a Setup.exe error occurs.



Silent Installation Commands.


  • setup.exe /q
          
  • setup.exe /qn
          
  • setup.exe /silent
          
  • setup.exe /s
          
  • setup.exe /NoUserInput
          
  • setup.exe /unattended
          
  • setup.exe /CreateAnswerFile
          
  • setup.exe /quiet