Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've made some changes to the %PATH% variable in the registry. Now, I'd like to see those changes applied without having to go so far as a logoff, reboot, or reload of Explorer. Is there a way this can be done?

I'd rather do this via some sort of command that can be put at the end of a .BAT file, and don't want to use any tools other than those that come with the OS in a fresh install. This needs to be minimally compatible with Windows XP SP3, and should work all the way up to Windows 7 x64 and Server 2008 R2.

share|improve this question
3… - You need to write/install a program that sends WM_SETTINGCHANGE message. – Zoredache Feb 16 '12 at 21:40
@Zoredache So, that's not something that can simply be done from the command prompt? Bummer. – Iszi Feb 16 '12 at 21:43
It is possible to shut down explorer , stuff in a change, and restart the explorer via CMD tools in XP. I used Kill /f, warned the user, put in a pause, then killed it. In 7 i think the command is taskkill. I have not tried that trick in 7. – Psycogeek Feb 17 '12 at 4:46

If you are trying to use the new value of the path variable from within a Windows command shell, all you should need to do is close your command shell window and open a new one. The new command shell will load the updated path variable.

So I think the answer to your original question sort of depends on where exactly you are trying to see the change take effect... Is there something specific that is not working for you?

share|improve this answer
I'll have to test this. I'd tried opening a new command shell, but hadn't closed the first yet I think. – Iszi Feb 17 '12 at 0:48
Also, which variable are you changing - the system path or the user path? I am nearly certain that the behavior will be different for each (they get refreshed based on different triggers). – Shannon Wagner Feb 17 '12 at 11:12
The variable is in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment – Iszi Feb 17 '12 at 17:10
Tested. No luck here. CMD shell was closed when Registry key was changed, opened a new one after and the PATH change doesn't seem to have taken effect. – Iszi Nov 3 '14 at 15:52
This doesn't actually work. It will load the old value of the path variable. – iopq Mar 31 '15 at 23:28
  • Change either User or System PATH in System Properties.
  • Running this batch file pulls the new PATH variables with a REG query.
  • The FOR commands parse the PATH variables from the REG results.
  • The current PATH is updated to the registry values.
  • I use ConEmu for my consoles and it runs this batch file on each new console to refresh the PATH so a reboot isn't necessary.

@echo off
echo Refreshing PATH from registry

:: Get System PATH
for /f "tokens=3*" %%A in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path') do set syspath=%%A%%B

:: Get User Path
for /f "tokens=3*" %%A in ('reg query "HKCU\Environment" /v Path') do set userpath=%%A%%B

:: Set Refreshed Path
set PATH=%userpath%;%syspath%

echo Refreshed PATH
echo %PATH%
share|improve this answer
  1. Change the PATH variable.
  2. Add a new environment variable, call it something random. Maybe something like CHANGE_TO_UPDATE and put a random value like x in it.
  3. Remember to restart cmd.exe or whatever program that needs to see the new path variable.

This will actually trigger the settings to update when you launch a new application.

share|improve this answer

The easiest way to add a variable to the path without rebooting is to open the command prompt and type: PATH=(VARIABLE);%path% and press enter. To check if your variable loaded, type PATH and press enter.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .