Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have this path

PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;c:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\

But when I open a cmd prompt, it won't run simple commands that are located in the Windows\system32 directory such as ipconfg, ping, etc.

Any ideas as to why or how to fix this stupid thing so I don't have to navigate to that directory everytime.

share|improve this question

migrated from serverfault.com Oct 16 '13 at 13:23

This question came from our site for professional system and network administrators.

    
What happens if you use start > Run > c:\windows\system32\cmd.exe and then enter the command you want? (I'm asking because cmd.exe sometimes gets hijacked etc.) –  Debra Oct 16 '13 at 13:29
    
And what does set path give you? –  Rik Oct 16 '13 at 14:15
    
@Debra it says command can't be found. –  MB34 Oct 16 '13 at 15:09
    
@Rik, It shows the path I posted in my question, duh. –  MB34 Oct 16 '13 at 15:09
    
Strange. For me its showing Path=C:\Windows\system32;.... etc. and not PATH=%SystemRoot%\system32;... etc. (%System% is substituted in my path. It only shows %SystemRoot% in my environment dialog-settings. Not at a command prompt) –  Rik Oct 16 '13 at 15:25
show 3 more comments

2 Answers

There is a missing ; from the end of the last entry, other than that it looks ok.

Try adding paths in one at a time until you get to the point it no longer behaves the way you expect.

share|improve this answer
add comment

You say that when you type set path in a command prompt the path also contains PATH=%systemroot%\system32. If this is the case your %systemroot% does not get expanded to C:\Windows when starting cmd.exe.

You can check your registry in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment. All the names containing values with % characters (e.g. windir, temp, path and comspec) should be of type REG_EXPAND_SZ (and not REG_SZ) or the variable won't be expanded.

share|improve this answer
    
I checked and these are all correct but it still doesn't expand the variables when I use set path. –  MB34 Oct 23 '13 at 2:56
    
If, however, I use echo %systemroot%, it shows c:\windows –  MB34 Oct 23 '13 at 2:57
    
This is strange. (I was almost certain that was it). Could you check the following: Is HKCU\Environment\Path (user-path) also of REG_EXPAND_SZ? Does that one contain unexpanded %-variables? Could you check the environment setting in Computer properties. They should not display %systemroot% in the list. Only when editing they should give %systemroot%. –  Rik Oct 23 '13 at 7:53
    
You could of course type the path in the variables dialog complete with C:\Windows instead of %systemroot% but that's just a workaround. BTW if my previous comment (about user-path) did not help could you type the first path in your complete path with C:\Windows. I read somewhere if the first character is % this could be a problem. It seems unlikely but easy to try. –  Rik Oct 23 '13 at 8:05
    
What is funny is that if I go to the Environment Variables window in CP, it shows c:\windows; .... not c:\%systemroot%; ... –  MB34 Oct 23 '13 at 11:30
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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