# MsiInstallProductW function (msi.h)

The MsiInstallProduct function installs or uninstalls a product.

## Syntax

``````UINT MsiInstallProductW(
[in] LPCWSTR szPackagePath,
[in] LPCWSTR szCommandLine
);
``````

## Parameters

`[in] szPackagePath`

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).

`[in] szCommandLine`

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.

## Return value

Value Meaning
ERROR_SUCCESS
The function completes successfully.
An error relating to an action
Initialization Error
An error that relates to initialization occurred.

## Remarks

The MsiInstallProduct function displays the user interface with the current settings and log mode.

Note

The msi.h header defines MsiInstallProduct as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

## Requirements

Minimum supported client 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.
Target Platform Windows
Library Msi.lib
DLL Msi.dll