Msiexec.exe用来解释和安装windows下的安装程序(*.msi) 。以下适用与3.0以后的版本。
一 Msiexec.exe的标准命令行参数,区分大小写。
Option | Parameters | Meaning |
---|---|---|
/help | Help and quick reference option. Displays the correct usage of the setup command including a list of all switches and behavior. The description of usage can be displayed in the user interface. Incorrect use of any option invokes this help option. Example: msiexec /help Note The equivalent Windows Installer Command-Line Option is /?. |
|
/quiet | Quiet display option. The installer runs an installation without displaying a user interface. No prompts, messages, or dialog boxes are displayed to the user. The user cannot cancel the installation. Use the /norestart or /forcerestart standard command-line options to control reboots. If no reboot options are specified, the installer restarts the computer whenever necessary without displaying any prompt or warning to the user. Examples: msiexec /package Application.msi /quiet Msiexec /uninstall Application.msi /quiet Msiexec /update msipatch.msp /quiet Msiexec /uninstall msipatch.msp /package Application.msi / quiet Note The equivalent Windows Installer Command-Line Option is /qn. |
|
/passive | Passive display option. The installer displays a progress bar to the user that indicates that an installation is in progress but no prompts or error messages are displayed to the user. The user cannot cancel the installation. Use the /norestart, /forcerestart, or /promptrestart standard command-line options to control reboots. If no reboot option is specified, the installer restarts the computer whenever necessary without displaying any prompt or warning to the user. Example: msiexec /package Application.msi /passive Note The equivalent Windows Installer Command-Line Option is /qb! with REBOOTPROMPT=S set on the command line. |
|
/norestart | Never restart option. The installer never restarts the computer after the installation. Example: msiexec /package Application.msi /norestart Note The equivalent Windows Installer command line has REBOOT=ReallySuppress set on the command line. |
|
/forcerestart | Always restart option. The installer always restarts the computer after every installation. Example: msiexec /package Application.msi /forcerestart Note The equivalent Windows Installer command line has REBOOT=Force set on the command line. |
|
/promptrestart | Prompt before restarting option. Displays a message that a restart is required to complete the installation and asks the user whether to restart the system now. This option cannot be used together with the /quiet option. Note The equivalent Windows Installer command line has REBOOTPROMPT = "" set on the command line. |
|
/uninstall | <Package.msi|ProductCode> | Uninstall product option. Uninstalls a product. Note The equivalent Windows Installer Command-Line Option is /x. |
/uninstall | /package <Package.msi | ProductCode> /uninstall <Update1.msp | PatchGUID1>[;Update2.msp | PatchGUID2] | Uninstall update option. Uninstalls an update patch. Note The equivalent Windows Installer Command-Line Option is /I with MSIPATCHREMOVE=Update1.msp | PatchGUID1[;Update2.msp | PatchGUID2] set on the command line. |
/log | <logfile> | Log option. Writes logging information into a log file at the specified existing path. The path to the log file location must already exist. The installer does not create the directory structure for the logfile.
The following information is entered into the log:
Note The equivalent Windows Installer Command-Line Option is /L*. Note For more information about all the methods that are available for setting the logging mode, see Normal Logging in the Windows Installer Logging section. |
/package | <Package.msi|ProductCode> | Install product option. Installs or configures a product. Note The equivalent Windows Installer Command-Line Option is /I. |
/update | <Update1.msp>[;Update2.msp] | Install patches option. Installs one or multiple patches. Note The equivalent Windows Installer command line has PATCH = [msipatch.msp]<;PatchGuid2> set on the command line. |
二 Msiexec.exe的一般命令行参数,区分大小写,部分与标准命令行参数等价。
Option | Parameters | Meaning |
---|---|---|
/I | Package|ProductCode | Installs or configures a product. |
/f | [p|o|e|d|c|a|u|m|s|v] Package|ProductCode | Repairs a product. This option ignores any property values entered on the command line. The default argument list for this option is 'omus.' This option shares the same argument list as the REINSTALLMODE property. p - Reinstalls only if file is missing. o - Reinstalls if file is missing or an older version is installed. e - Reinstalls if file is missing or an equal or older version is installed. d - Reinstalls if file is missing or a different version is installed. c - Reinstalls if file is missing or the stored checksum does not match the calculated value. Only repairs files that have msidbFileAttributesChecksum in the Attributes column of the File table. a - Forces all files to be reinstalled. u - Rewrites all required user-specific registry entries. m - Rewrites all required computer-specific registry entries. s - Overwrites all existing shortcuts. v - Runs from source and re-caches the local package. Do not use the v reinstall option for the first installation of an application or feature. |
/a | Package | Administrative installation option. Installs a product on the network. |
/x | Package|ProductCode | Uninstalls a product. |
/j | [u|m]Package or [u|m]Package/tTransform List or [u|m]Package/gLanguageID |
Advertises a product. This option ignores any property values entered on the command line. u - Advertises to the current user. m - Advertises to all users of machine. g - Language identifier. t - Applies transform to advertised package. |
/L | [i|w|e|a|r|u|c|m|o|p|v|x|+|!|*] Logfile | Writes logging information into a logfile at the specified existing path. The path to the logfile location must already exist. The installer does not create the directory structure for the logfile. Flags indicate which information to log. If no flags are specified, the default is 'iwearmo.' i - Status messages. w - Nonfatal warnings. e - All error messages. a - Start up of actions. r - Action-specific records. u - User requests. c - Initial UI parameters. m - Out-of-memory or fatal exit information. o - Out-of-disk-space messages. p - Terminal properties. v - Verbose output. x - Extra debugging information.
+ - Append to existing file. ! - Flush each line to the log. "*" - Wildcard, log all information except for the v and x options. To include the v and x options, specify "/l*vx". Note For more information about all the methods that are available for setting the logging mode, see Normal Logging in the Windows Installer Logging section |
/m | filename Note The length of filename must be no more than eight characters. |
Generates an SMS status .mif file. Must be used with either the install (-i), remove (-x), administrative installation (-a), or reinstall (-f) options. The ISMIF32.DLL is installed as part of SMS and must be on the path. The fields of the status mif file are filled with the following information: Manufacturer - Author Product - Revision Number Version - Subject Locale - Template Serial Number - not set Installation - set by ISMIF32.DLL to "DateTime" InstallStatus - "Success" or "Failed" Description - Error messages in the following order: 1) Error messages generated by installer. 2) Resource from Msi.dll if installation could not commence or user exit. 3) System error message file. 4) Formatted message: "Installer error %i", where %i is error returned from Msi.dll. |
/p | PatchPackage[;patchPackage2…] | Applies a patch. To apply a patch to an installed administrative image you must combine the following options: /p <PatchPackage>[;patchPackage2…] /a <Package> |
/q | n|b|r|f | Sets user interface level. q , qn - No UI qb - Basic UI. Use qb! to hide the Cancel button. qr - Reduced UI with no modal dialog box displayed at the end of the installation. qf - Full UI and any authored FatalError, UserExit, or Exit modal dialog boxes at the end. qn+ - No UI except for a modal dialog box displayed at the end. qb+ - Basic UI with a modal dialog box displayed at the end. The modal box is not displayed if the user cancels the installation. Use qb+! or qb!+ to hide the Cancel button. qb- - Basic UI with no modal dialog boxes. Please note that /qb+- is not a supported UI level. Use qb-! or qb!- to hide the Cancel button. Note that the ! option is available with Windows Installer 2.0 and works only with basic UI. It is not valid with full UI. |
/? or /h | Displays copyright information for Windows Installer. |
|
/y | module | Calls the system function DllRegisterServer to self-register modules passed in on the command line. Specify the full path to the DLL. For example, for MY_FILE.DLL in the current folder you can use: msiexec /y .\MY_FILE.DLL This option is only used for registry information that cannot be added using the registry tables of the .msi file. |
/z | module | Calls the system function DllUnRegisterServer to unregister modules passed in on the command line. Specify the full path to the DLL. For example, for MY_FILE.DLL in the current folder you can use: msiexec /z .\MY_FILE.DLL This option is only used for registry information that cannot be removed using the registry tables of the .msi file. |
/c | Advertises a new instance of the product. Must be used in conjunction with /t. Available starting with the Windows Installer version that is shipped with Windows Server 2003 and Windows XP with Service Pack 1 (SP1). |
|
/n | ProductCode | Specifies a particular instance of the product. Used to identify an instance installed using the multiple instance support through a product code changing transforms. Available starting with the Windows Installer version shipped with Windows Server 2003 and Windows XP with SP1. |
三 Msiexec.exe 4.5的帮助。可以运行 msiexec.exe /help来查看。
Windows ® Installer. V 4.5.6001.22159
msiexec /Option <Required Parameter> [Optional Parameter]
Install Options
</package | /i> <Product.msi>
Installs or configures a product
/a <Product.msi>
Administrative install - Installs a product on the network
/j<u|m> <Product.msi> [/t <Transform List>] [/g <Language ID>]
Advertises a product - m to all users, u to current user
</uninstall | /x> <Product.msi | ProductCode>
Uninstalls the product
Display Options
/quiet
Quiet mode, no user interaction
/passive
Unattended mode - progress bar only
/q[n|b|r|f]
Sets user interface level
n - No UI
b - Basic UI
r - Reduced UI
f - Full UI (default)
/help
Help information
Restart Options
/norestart
Do not restart after the installation is complete
/promptrestart
Prompts the user for restart if necessary
/forcerestart
Always restart the computer after installation
Logging Options
/l[i|w|e|a|r|u|c|m|o|p|v|x|+|!|*] <LogFile>
i - Status messages
w - Nonfatal warnings
e - All error messages
a - Start up of actions
r - Action-specific records
u - User requests
c - Initial UI parameters
m - Out-of-memory or fatal exit information
o - Out-of-disk-space messages
p - Terminal properties
v - Verbose output
x - Extra debugging information
+ - Append to existing log file
! - Flush each line to the log
* - Log all information, except for v and x options
/log <LogFile>
Equivalent of /l* <LogFile>
Update Options
/update <Update1.msp>[;Update2.msp]
Applies update(s)
/uninstall <PatchCodeGuid>[;Update2.msp] /package <Product.msi | ProductCode>
Remove update(s) for a product
Repair Options
/f[p|e|c|m|s|o|d|a|u|v] <Product.msi | ProductCode>
Repairs a product
p - only if file is missing
o - if file is missing or an older version is installed (default)
e - if file is missing or an equal or older version is installed
d - if file is missing or a different version is installed
c - if file is missing or checksum does not match the calculated value
a - forces all files to be reinstalled
u - all required user-specific registry entries (default)
m - all required computer-specific registry entries (default)
s - all existing shortcuts (default)
v - runs from source and recaches local package
Setting Public Properties
[PROPERTY=PropertyValue]
Consult the Windows ® Installer SDK for additional documentation on the
command line syntax.
Copyright © Microsoft Corporation. All rights reserved.
Portions of this software are based in part on the work of the Independent JPEG Group.
四 参考:
1) http://msdn.microsoft.com/en-us/library/aa372866.aspx
2) http://blogs.msdn.com/windows_installer_team/default.aspx
Windows Installer 2.0:http://msdn.microsoft.com/en-us/library/aa372024(VS.85).aspx
Windows Installer 3.0:http://msdn.microsoft.com/en-us/library/aa367988(VS.85).aspx
五 完!