Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to modify Path Variables in MSI


I shall convert InstallAware scripting into true MSI tables. (Not just InstallScript.)

To determine the installation folder there is a script logic  like

if Setup_Parameter_platform = 2 (

Set TARGETDIR to RegKey2

if TARGETDIR ="" (

Set TARGETDIR to RegKey1

if TARGETDIR ="" (

Set TARGETDIR to RegKey1b


Set TARGETDIR to default


How can I convert this into "true MSI"?

And if not really possible, can I build a small script function, receiving , modifying and returning a Path Variable property?

Best Regards,


Labels (1)
0 Kudos
1 Reply

Re: How to modify Path Variables in MSI

Hi @thomas64 ,

It can be achieved by adding a installscript custom action to set the INSTALLDIR with the Reg keyvalues.

You can refer the below link for the Basic MSI custom action to set the INSTALLDIR:


Apart from the above, you can create system search to set the INSTALLDIR:

Below steps describe how to configure INSTALLDIR to  a custom predefined folders:

1- Create a Basic MSI project.

2-  Go to the System Search view

3- Add a "Registry entry" system search by clicking "Add.." from the right click context menu in the system search view.

4- Enter the  details in the system search wizard from where you want to read the path, below keys read the program files ARM path:

    Registry Root:  HKEY_LOCAL_MACHINE

   Registry Key: SOFTWARE\Microsoft\Windows\CurrentVersion

   Registry Value: ProgramFilesDir (Arm)

   Search the 64-Bit Portion of the Registry :  Select this option

   [ Click Next Button in wizard to move to next page]

   Store the values in this property :  PROGRAMFILESARM

   Just store the value in the property:  Select this option 

   [ Click Finish Button in wizard to close wizard and add the system search]

 5- Got to "General Information" view, and update the "INSTALLDIR" with the property defined in Step 4 (PROGRAMFILESARM)

    Like:-  INSTALLDIR  = [PROGRAMFILESARM]My Company Name\My Product Name

6- Add files to your project, Build the msi, and check the run time behavior whether the pay loads are copied to the selected INSTALL DIR path.

0 Kudos