0

Sometimes, my command prompt cannot find the PATH variable. I have this occasional problem at work where when I open command-prompt and run commands like ipconfig or subst, I get an error saying something like 'ipconfig' is not recognized as an internal or external command. When I try this echo %path%, it prints out %path% instead of the PATH value. If I look at my Environment Variables window, the PATH is defined right there but I don't know why CMD can't find it. At this point, I understand why the other commands were not being recognized since their paths are in PATH variable.

However, I cannot understand why the PATH variable is not being found. If I restart the computer, everything is back to normal. In a few days, I might have the same experience again.

I tried using this answer. It suggested changing a registry value but mine already had the value that was suggested yet it wasn't working. (The restart step at the end would have solved it as usual but that's not the point.)

Any suggestions regarding why the PATH variable may become invisible every now and then and how I can prevent it from happening again?

1
  • 1
    Please specify the complete path as seen in the "Environment Variables window". Both your user path and system-wide path. (You can edit them in your question.) You could have run a program which deletes the path-variable (until reboot). I take it the set path-command gives no path-variable at that point and echo %systemroot% works as expected (giving C:\Windows)? (so expanding is working)
    – Rik
    Oct 31, 2013 at 21:45

2 Answers 2

2

This can be a problem when you have a very long PATH variable and/or a huge amount of other long environment variables set. It can also happen if you have spaces next to your semicolon delimiters and if you have a % as the first character in your path.

You may have some luck with FixPath which fixes some common path problems automatically.

0

I've had similar issues with a windows machine running a corporate group policy where the machine is only affected when connected to the corporate network

Often this also affects connections to port ranges that you may use on other networks - they just stop working.

There are few tips on editing your path on the command line which I've written up on the community wiki here: https://superuser.com/posts/781483/revisions

Under these circumstances typing:

C:\WINDOWS>PATH

Will print the full variable. More effective than 'echo' which can just print '%path%' as you discovered.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .