When I tried to ping, ipconfig or similar, the prompt just said something like ""ipconfig" is not recognized as an internal or external command, operable system program or batch file.".
I checked the path variable under the "Environment Variables" ([WIN] + [Pause] ≫ Advanced ≫ Environment Variables): %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\WBEM
Okay, this looks good. So tried "echo %systemroot%" in the Command Prompt ([WIN] + [R] ≫ cmd) and the variable got correctly resolved: "C:\WINDOWS".
But when I tried "path" in the Command Prompt I got "PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\WBEM;…". Correctly it should be "PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;…". Apparently the path variables didn't get resolved for some reason.
Not knowing what the problem was I played around a bit with the "path variable" and suddenly it worked again. But not for long, next time I restarted the same problem reappeared. So decided to do a little research through Google and found this helpful blog post.
Solution
The problem is that the path key in the registry should be of the type "Reg_Expand_SZ" and mysteriously it was of type "Reg_SZ".
Here the step-by-step solution:
- Go to: Start > Run > Regedit (alt.: [WIN] +[R] > regedit)
- Check: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
- Make sure that the registry key holding the path is of Reg_Expand_SZ type rather Reg_SZ type
- If the holding key is Reg_SZ change it into Reg_Expand_SZ by:
- Double Click "Path" and copy it's Data Value "…%SystemRoot%\system32;%SystemRoot%; …" to avoid to rewrite it again
- Delete the "Path"
- Create New > Expandable String Value
- Give "Path" as the name, double click it, and Paste the value copied in the previous step to the "Value Data" field
- Close the Regedit window and restart your system or just log-off and on
Another step-by-step solution without using the registry and which should do the same:
- Go to the "Environment Variables"
- [WIN] + [Pause] > Advanced > Environment Variables
- Under "System variables" double click on "Path"
- Copy the the whole path (%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\WBEM;…)
- Click Cancel
- Delete the "Path" variable
- Click New and use the same name "Path" and paste now the old Path variable values
- Click OK and OK
- Now restart or just log-off and on
Hello,
ReplyDeleteI had the same symptom, but the path entry in the registry was of type Reg_Expand_SZ.
Then I added a manual entry of c:\windows\system32 in the path variable before the unresolved %systemroot%\system32. Then opened a command prompt and it worked. Then I took the manually added entry out again and it still resolved correctly and kept on working.
Cheers
Andy
I had the same symptom, but only in the user path section. The HKEY_LOCAL_MACHINE\... key was set to Reg_Expand_SZ, but the user path under HKEY_CURRENT_USER\Environment was not. Changed it, worked. Thanks a lot.
ReplyDelete