Imagine the following environment variables:
System PATH = C:\Windows
Bob's User PATH = C:\Users\Bob
In a command prompt the PATH
command returns C:\Windows;C:\Users\Bob
After running setx /m PATH "C:\Node;%PATH%"
System PATH = C:\Node;C:\Windows;C:\Users\Bob
In a new command prompt the PATH
command returns C:\Node;C:\Windows;C:\Users\Bob;C:\Users\Bob
Another user, Alice, logs in.
Alice's User PATH = C:\Users\Alice
On a command prompt the PATH
command returns C:\Node;C:\Windows;C:\Users\Bob;C:\Users\Alice
Bob has a duplicate path in his PATH
variable, and Alice has Bob's paths in her PATH
variable.
Is there a way to append to the System PATH
without polluting it with the current user's PATH
?
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v path
. If that still works on Windows 8, then use that to build the new value. (You'll have to figure out how to parse the output ofreg query
.)