I am trying to set the PATH environment variable in windows 7 using a bat-file; however it does not seem to work.
I am using this windows command:
se
As wizlb noted, doing
setx PATH "%cd%;%path%;" -m
will copy local env to system env, and without -m it will copy system env to user env. Neither is desirable. In order to accurately edit only one part of registry (system or user, system in my below example) you need to do this:
for /F "tokens=2* delims= " %%f IN ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path ^| findstr /i path') do set OLD_SYSTEM_PATH=%%g
setx.exe PATH "%OLD_SYSTEM_PATH%;%OTHER_STUFF%;" -m
Credit for the solution goes to http://www.robvanderwoude.com/ntregistry.php