Sunday, February 04, 2007

Command Paths not working, and %SystemRoot% not resolving...and a fix

This happened to apply to my brand spanking new Dell Latitude D820, however, I believe it is a more general problem that can occur with Windows. I don't know what situations create the problem, but I did find a solution. Also searching the web for this problem reveals others have been troubled with it as well.

Ok, so I found simple "always there" commands weren't working, such as ping or ipconfig. When trying to launch ipconfig from the command line I would get: 'ipconfig' is not recognized as an internal or external command, operable program or batch file. (You can see it in the screenshot of my Command Prompt below.)

I did an echo %PATH% and observed that %SystemRoot% was not being evaluated. You can see from the screenshot below instead of showing "C:\WINDOWS" it was showing %SystemRoot% (I've highlighted them in red.) This is the state the computer shipped from Dell with a purchased copy of XP Pro installed so this situation is going to affect a LOT of users. Of course, maybe most Dell customers don't use the command line.


Scroll down to see the screenshot... argh these blogspot templates suck at handling wide images.


















Here's a screenshot of the error, and the faulty path lookup in action.


So my immediate thought was that %SystemRoot% hadn't been setup in the Windows Environment Variables. However, bringing up the dialog showed me that it was:



Anyway, the solution is just to kick Windows XP into re-evaluating the %Path% variable. The entries were all there, but somehow Windows has cached an invalid lookup for it. The easiest way I believe to do this is to go into the environment variables. Just click edit, you don't even have to change anything, and then click OK.




Now your old command prompt if it is open won't be updated, but if you open a new one, everything should work as you expected.


4 comments:

Maciek said...

Hi,
thanks for help. I had the same problem with some machines which (probably) were installed using some mass deployment tools (sysprep?) - similar to Dell. Anyway there was slight difference - I had to make SOME change in path (deleted % from %systemroot%), applied, then typed back % and applied again -then it worked.
Thanks again
kind regards

Justin Holzer said...

I actually had this exact same problem today. It appeared to be caused by having the '%' character as the first character in the PATH string. As long as I put something other than '%' at the beginning of the PATH string, Windows had no issues resolving %SystemRoot%, or any other variable. My advice, just make sure the first directory in your path is hard-coded (i.e. c:\foo), and this problem can hopefully be avoided.

David said...

Hi,

Very GREAT HELP on this blog!!!

I also want to add on that in the path field, do NOT key after any semi colon, any space between a path will render it as invalid.

David said...

Hi,

Very GREAT HELP on this blog!!!

I also want to add on that in the path field, do NOT press "SPACE BAR" after any semi colon, any space between a path will render it as invalid.