I am very confused on what is incorrect with my Windows Path variable.

In my System Settings I have the System Variable Path set to:


Yet, when I try to run hg.exe (in C:\Program Files\TortoiseHg) from the command line in another directory it returns "hg is not recognized as an internal or external command, operable program or batch file".

I thought that if I set my Path to include the executable directory, then I could run hg commands from any directory. Why is this not working? How can I make my Path variable set to something global? Maybe I don't understand the difference between a User Environment variable and a System environment variable?

**Note that if I echo %path% from my command line I get something slightly different than what shows in System Variables:

C:\Users\stankard>echo %path%
  • 2
    If you have transcribed your PATH variable correctly, then you have omitted the blank in "Program Files".
    – AFH
    Oct 14, 2014 at 16:21
  • And why do you have ** at the end of your path? You also have WindowsPowerShell twice in your path.
    – DavidPostill
    Oct 14, 2014 at 16:45
  • The ** is there from when I had formatted the text I believe. This is now edited
    – user379559
    Oct 14, 2014 at 17:01

1 Answer 1


As AFH points out in his comment, if you've transcribed your path here properly, then you forgot the space in "Program Files".

Additionally, you can't use a environment variables in your path, so "%ANT-HOME%" isn't going to work and could be messing up the paths after it.

See this SU question: Why can't Windows handle an environment variable in Path?

  • This is really helpful-- thanks. What is the difference between %path% and how it appears in the gui? In My Computer-->Properties-->AdvancedSystemSettings-->EnvironmentVariables .. My Path variable there is different than when I echo %Path%. Why is this? I am going to restart and see if my changes update..
    – user379559
    Oct 14, 2014 at 16:58
  • The PATH in the command prompt is the System's Path + your User's Path. Oct 14, 2014 at 17:04
  • Ah thank you very much for clarification TECHIE007. Restart took care of all changes. Biggest problem as far as I can tell is the space that I omitted in "ProgramFiles" vs "Program Files" so thank you very much @AFH ! I also had removed my '%ANT_HOME%' so this was perhaps useful as well.
    – user379559
    Oct 14, 2014 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.