How to persistently set a variable in Windows 7 from a batch file?

Viewed 84254

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:

set PATH=%cd%;%path%
pause

However it only appears to be valid for this cmd instance. I want it to be permanent, since I first set the PATH and then run a program which needs to locate the libraries in that folder.

7 Answers

Use This command setx PATH "%PATH%;%MVN_HOME%\bin\"

Anyways it wont be set in current session you need to use

set PATH="%PATH%;%MVN_HOME%\bin\"

Related