Weird PATH issue

Associate
Joined
14 May 2009
Posts
2,371
If I run CMD the usual CMD.EXE window appears but any commands I type end up with something like

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

So you say your PATH is broken. Can't disagree. Typing PATH shows the standard output with a list of semi-colon separated directories. First being

Code:
PATH=%SystemRoot%\system32;

And typing
Code:
%systemroot%\system32\ping

runs ping as expected.

If I type PATH to display it, then copy the whole of the PATH=.... and then simply paste it back into the cmd window, redefining the PATH to be the same as before, then the commands are found as expected.

I don't understand how the 2 seemingly identical path values can behave differently.

Any thoughts O clever ones?

TIA

Oh, Windows 11 so I've got the new tabbed cmd app ( Microsoft Windows [Version 10.0.22621.2134] )
 
Yes it really shows %SystemRoot%, that was a copy and paste from the CMD window. Checking the registry, as suggested, doesn't seem to show me what the problem is.

Just had another play though, used the Control Panel Environment Variable cmdlet, I moved the %SystemRoot%\bin to the end of the list of folders. Ping worked so I went looking for a badly formed folder in the list by moving the entry back up the list until it went wrong. It never did! The %SystemRoot%\bin is the first entry again and ping is again working. All very strange.

Thanks for your help.
 
I didn't twig this before but the Control Panel did show the full path. I'm guessing when I moved the the folder ordering, using this Control Panel applet, the effect was to replace the %SystemRoot% with the expanded value as PATH how now lost the %SystemRoot% values and got the c:\windows.

Ta for the reply
 
Back
Top Bottom