Hi all,
I was trying to add an environment to the System PATH. I used the following script I found in the NSIS archive, where $R0 has the path I want to add. I am using a Windows XP machine.
ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" "$R0;$1"
However, this doesn't take effect until I reboot the system. I need to acheive the same effect as when you go to "System Properties" (Right click "My Computer" and select "Properties") and in the "Advanced" tab, click "Environment Variables" and edit the PATH in the System variables. This doesn't require reboot. Is there any command that I can use?
Help greatly appreciated!
Kimmy
Change Environment Variable w/o reboot
3 posts
Look in the archive.
Changing the PATH without rebooting:
Changing environment variables without rebooting:
Changing the PATH without rebooting:
Changing environment variables without rebooting:
Thank you pengyou.
I have a question though. The PATH Manipulation script was actually changing the PATH for the current user. If I want to change it for All Users, do I just replace
HKCU "Environment" "PATH"
with
HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
?
Thanks...
I have a question though. The PATH Manipulation script was actually changing the PATH for the current user. If I want to change it for All Users, do I just replace
HKCU "Environment" "PATH"
with
HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
?
Thanks...