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