- 1 year ago
How to make msi block installing to ProgramFiles folder?
By default, MSI installers are designed to install applications into the ProgramFiles
folder on Windows. However, if you want to prevent an MSI installer from installing to the ProgramFiles
folder, you can modify the installation properties using a transform (MST) file. Here's how you can do it:
Create a Transform (MST) File: Use a tool like Orca (available in the Windows SDK) to create a transform file for the MSI installer. Launch Orca and open the MSI installer file.
Edit the INSTALLDIR Property: In the Property table of the MSI, locate the
INSTALLDIR
property. By default, its value is set to[ProgramFilesFolder]
. Change the value to a different directory where you want the application to be installed (e.g.,[TARGETDIR]
).Save the Transform File: After making the necessary changes, save the transform file (MST) using the File menu in Orca.
Install the Application with the Transform File: Open a command prompt with administrative privileges and run the following command to install the application with the transform file:
bashmsiexec /i YourInstaller.msi TRANSFORMS=YourTransform.mst
Replace
YourInstaller.msi
with the path to the original MSI installer file, andYourTransform.mst
with the path to the transform (MST) file you created.
By applying the transform file during installation, you can change the INSTALLDIR
property and specify a different installation directory instead of the ProgramFiles
folder.
Please note that modifying the default installation behavior of an MSI installer may go against the application's intended design and could cause compatibility or functionality issues. Make sure to test the modified installation thoroughly and consider consulting with the application vendor or developer for any specific instructions or recommendations.