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