I’m writing a dos-batch in which I need to change the PATH.
I’m using the SET command.
The batch is run from the command line (cmd.exe).
The problem : the changes are only available for the cmd window, and I soon as this window is closed, the changes are dismissed.
How can I change the PATH from a batch and make sure the change will affect the whole system ?
There is a tool
setx.exeprovided in the Windows XP Service Pack 2 Support Tools that can be used to permanently change an environment variable from the command line:Source: http://vlaurie.com/computers2/Articles/environment.htm
The above link also gives the location of the registry keys that store the system / user environment variables – if you are feeling adventurous you could also try setting those.
User environment variables:
System environment variables: