I want to install a msi with msiexec in a specific directory. I\'m using:
msiexec /i \"msi path\" INSTALLDIR=\"C:\\myfolder\" /qb
It is no
I tried TARGETDIR
, INSTALLLOCATION
and INSTALLDIR
args and still it installed in the default directory.
So I viewed the log and there is this arg where it sets the Application Directory and it is being set to default.
MSI (s) (50:94) [09:03:13:374]: Running product '{BDAFD18D-0395-4E72-B295-1EA66A7B80CF}' with elevated privileges: Product is assigned.
MSI (s) (50:94) [09:03:13:374]: PROPERTY CHANGE: Adding APPDIR property. Its value is 'E:\RMP2'.
MSI (s) (50:94) [09:03:13:374]: PROPERTY CHANGE: Adding CURRENTDIRECTORY property. Its value is 'C:\Users\Administrator'.
So I changed the command to have APPDIR
instead of the args mentioned above. It worked like a charm.
msiexec /i "path_to_msi" APPDIR="path_to_installation_dir" /q
Add /lv
if you want to copy the installation progress to a logfile.
In my case all of them did not work and finally it was
msiexec /i "msinamebla.msi" INSTALLFOLDER="C:\test\" /qb
I checked the log.txt as described by ezzadeen and found "INSTALLFOLDER" in there.
Actually, both INSTALLPATH/TARGETDIR
are correct. It depends on how MSI processes this.
I create a MSG using wixToolSet
. In WXS file, there is "Directory" Node, which root dir maybe like the following:
<Directory Id="**TARGETDIR**" Name="SourceDir">;
As you can see: Id
is which you should use.
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
If you've used Advanced Installer
to build your .msi you will want to use APPDIR=
This one worked for me too
msiexec /i "msi path" INSTALLDIR="D:\myfolder" /q
I had tried two other iterations and both installed in the default C:\Program Files
INSTALLDIR="D:\myfolder" /q got it installed on the other drive.