Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can anyone give me a example of modifying windows environment system variables in WIX?

I still don't know how to add the installdir into the PATH of the Windows System Variables after I went through the WIX tutorial.

I tried to use

  Environment Id='UpdatePath' Action='create' Name='PATH'  System='yes' Value='[INSTALLDIR]'  

But there was no change in the Path after I installed the program. I can hardly find sample code of WIX anywhere. Please help me, thanks a lot!

like image 677
Ray Avatar asked Dec 19 '09 01:12

Ray


People also ask

Can you make your own Environment Variables?

On the Windows taskbar, right-click the Windows icon and select System. In the Settings window, under Related Settings, click Advanced system settings. On the Advanced tab, click Environment Variables. Click New to create a new environment variable.

Can you edit system variables?

In the System Properties window, click “Environment Variables.” Click on the variable you'd like to change, click “Edit.” Many environment variables will simply take a name and value, like “Number of processors.” All you have to do to edit them is to change the value, and click “OK.”


2 Answers

You should be able to use:

<Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]" Permanent="yes" Part="last" Action="set" System="yes" /> 

This should add a new entry to the environment path, set to [INSTALLDIR].

like image 118
Reed Copsey Avatar answered Oct 03 '22 21:10

Reed Copsey


Another thing to note is, Environment need to be placed inside a component with directory, e.g.

<DirectoryRef Id="TARGETDIR">   <Component Id="Path" Guid="{xxx-xxx-xxx-xxx}">     <Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]" Permanent="no" Part="last" Action="set" System="no" />   </Component> </DirectoryRef> 

Details of Wix Element described at Environment Element

like image 34
Deqing Avatar answered Oct 03 '22 22:10

Deqing