pathinstallationwindows-installer

How do you install an MSI with msiexec into a specific directory?


I want to install an MSI file with msiexec into a specific directory. I am using:

msiexec /i "msi path" INSTALLDIR="C:\myfolder" /qb

Using "INSTALLDIR" is not working properly because the MSI is installed into the default path and not into the specified path.


Solution

  • Use TARGETDIR instead of INSTALLDIR. Note that the quote marks for TARGETDIR property are only around the path in the case of spaces.

    msiexec /i "msi path" TARGETDIR="C:\myfolder" /qb
    

    Source: https://learn.microsoft.com/en-us/windows/win32/msi/targetdir