MsiInstallProduct function
The MsiInstallProduct function installs or uninstalls a product.
Syntax
UINT MsiInstallProduct( _In_ LPCTSTR szPackagePath, _In_ LPCTSTR szCommandLine );
Parameters
- szPackagePath [in]
-
A null-terminated string that specifies the path to the location of the Windows Installer package. The string value can contain a URL (e.g.
http://packageLocation/package/package.msi), a network path (e.g. \\packageLocation\package.msi), a file path (e.g. file://packageLocation/package.msi), or a local path (e.g. D:\packageLocation\package.msi). - szCommandLine [in]
-
A null-terminated string that specifies the command line property settings. This should be a list of the format Property=Setting Property=Setting. For more information, see About Properties.
To perform an administrative installation, include ACTION=ADMIN in szCommandLine. For more information, see the ACTION property.
Return value
| Value | Meaning |
|---|---|
|
The function completes successfully. |
|
For more information, see Error Codes. |
|
An error that relates to initialization occurred. |
For more information, see Displayed Error Messages.
Remarks
The MsiInstallProduct function displays the user interface with the current settings and log mode.
- You can change user interface settings by using the MsiSetInternalUI, MsiSetExternalUI, or MsiSetExternalUIRecord functions.
- You can set the log mode by using the MsiEnableLog function.
- You can completely remove a product by setting REMOVE=ALL in szCommandLine.
For more information, see REMOVE Property.
Requirements
|
Version |
Windows Installer 5.0 on Windows Server 2012, Windows 8, Windows Server 2008 R2 or Windows 7. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version. |
|---|---|
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names |
MsiInstallProductW (Unicode) and MsiInstallProductA (ANSI) |
See also
- Displayed Error Messages
- Error Codes
- Initialization Error
- Installation and Configuration Functions
- Multiple-Package Installations