Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 7 environment variable not working in path

I am trying to set up some path using environment variable. I added an environment variable "MAVEN_HOME" with the value "C:\maven". Then in the path I added "%MAVEN_HOME%\bin;...rest". When I type "echo $MAVEN_HOME%" I get the correct "C:\maven" printed on the screen. But when I type "mvn" which is a batch file in the "bin" directory, it can't find it.

So, I manually added the entire path in PATH. "C:\maven\bin;...rest" and it was able to find "mvn" and execute it.

Could someone help me what I did wrong?

like image 577
jiminssy Avatar asked Dec 31 '11 01:12

jiminssy


People also ask

How do I restore the Path variable in Windows 7?

Tried following steps to recover my variables successfully on my Windows 7. Go to "My Computer" properties -> "Advanced system settings" -> click on "Advanced" tab -> click on "Environment Variables" button -> Edit "PATH" variable and paste everything copied in the third step in -> Variable value: box.

What is the PATH of environment variable in Windows 7?

PATH is an environment variable that holds all the executable shell commands. When you type something in the command prompt, it will go through all the path and search for the match of the command line utility name you have just entered.

How do I set Environment Variables in PATH?

To add a path to the PATH environment variableIn the System dialog box, click Advanced system settings. On the Advanced tab of the System Properties dialog box, click Environment Variables. In the System Variables box of the Environment Variables dialog box, scroll to Path and select it.


1 Answers

Check if there is a space character between the previous path and the next:

Incorrect: c:\path1; c:\Maven\bin\; c:\path2\

Correct: c:\path1;c:\Maven\bin\;c:\path2\

like image 98
Daniel Bonetti Avatar answered Sep 28 '22 05:09

Daniel Bonetti