Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting environment variables requires reboot on 64-bit

I am working on an installer using Wix 3.5 that needs to set the system PATH environment variable.

This is how I am setting the environment variable:

<Directory Id="DirectoryName">     <Component Id="ComponentID" Guid="{BE20AF67-5943-4AF4-BE66-226E2D4B844F}">         <Environment Id="EnvironmentID" Name="PATH" Action="set" Value="the path" Part="last" Separator=";" System="yes" />     </Component> </Directory> 

This seems to be working on 32-bit systems without requiring a reboot for the changes to be recognized. However, when I try it on 64-bit Windows 7 a reboot is required.

Is this a known issue on 64-bit systems?

Maybe the best approach would be to schedule a reboot to cover all bases.

Thanks, Alan

like image 775
Alan Spark Avatar asked Aug 08 '11 08:08

Alan Spark


People also ask

Do I need to reboot after adding environment variable?

No, you don't need to restart your system. However, you have to restart your command prompt application to update the changes done on Environment variables.

How do I set environment variables permanently?

You can set an environment variable permanently by placing an export command in your Bash shell's startup script " ~/. bashrc " (or "~/. bash_profile ", or " ~/. profile ") of your home directory; or " /etc/profile " for system-wide operations.

How do I permanently set environment variables in Windows?

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.


1 Answers

Check this question on ServerFault: How do you add a Windows environment variable without rebooting?

So to propagate the change to the list of environment variables, you can write a small program which broadcasts WM_SETTINGCHANGE message as described in KB article How to propagate environment variables to the system.

like image 108
Alexey Ivanov Avatar answered Sep 20 '22 19:09

Alexey Ivanov