I have my PATH variable set on my Windows 7 machine, and everything appears normal when I do

echo %Path%

The paths look fine and are separated by ";" like normal, however, when I try to run any custom command executables (like git), I get something like

'git' is not recognized as an internal or external command, operable program or batch file.

This happens even though my Path variable shows C:\Program Files (x86)\Git\bin; as one of the paths. If I run the exe from Windows Explorer, it runs just fine. Also, I have tried restarting the cmd and doing a full reboot with the same result. What could be the cause of this?

here is the result of echo %Path%:

C:\Windows\system32;C:\Windows;C:\Windows\system32\Wbem;C:\Windows\system32\WindowsPowerShell\v1.0\; C:\Program Files (x86)\OpenSSH; C:\Python27; C:\Program Files (x86)\nodejs;  C:\Program Files (x86)\Git\bin;  C:\Program Files\Mercurial; C:\Program Files (x86)

And here is what it is actually set to:

 %SystemRoot%\system32\; %SystemRoot%\; %SystemRoot%\System32\Wbem\; %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;  C:\Program Files (x86)\OpenSSH\bin\;  C:\Python27\;  C:\Program Files (x86)\curl-7.23\;  C:\Program Files (x86)\Git\bin\;  C:\Program Files (x86)\nodejs\;   C:\Program Files (x86)\PHP\;  C:\Program Files\Mercurial
  • Can you post the result of your echo %PATH%? – Canadian Luke Aug 3 '12 at 20:08

Only ; is used to separate directories in the path name. As a result, every character has to be treated literally.

This includes spaces. Otherwise, it wouldn't be possible to specify directories that end or even begin with a space (the drive letter is optional).

Set your path to

%SystemRoot%\system32\;%SystemRoot%\;%SystemRoot%\System32\Wbem\;%SystemRoot%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\OpenSSH\bin\;C:\Python27\;C:\Program Files (x86)\curl-7.23\;C:\Program Files (x86)\Git\bin\;C:\Program Files (x86)\nodejs\;C:\Program Files (x86)\PHP\;C:\Program Files\Mercurial

and it should work.

  • No, my output is the same, unfortunately. – Morgan Herlocker Aug 3 '12 at 20:25
  • @MorganHerlocker See my edit. – Dennis Aug 3 '12 at 20:51
  • Wow, thanks! Idk if I ever would have figured that out. – Morgan Herlocker Aug 6 '12 at 13:26

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.