I have an HP laptop with a Windows 7 32-bit Home Premium operating system. My command prompt doesn't run lots of commands like help, shutdown, ipconfig, ping, etc. I get a message like:
'help' is not recognized as an internal or external command, operable program or batch file.Only simple commands like cd and dir are working. I noticed that whenever I navigate to c:/windows/system32, the command works. But I need to run some important commands like java on a file that is on the desktop and not in the system32 folder.
How can I fix this?
56 Answers
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 (or other real Windows-directory) 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.
You should also check HKEY_CURRENT_USER\Environment if path is of type REG_EXPAND_SZ.
Maybe the environment variables aren't set the right way:
- Right click
Computer→Properties→Advanced System Settings→Advanced(tab) →Environment Variables… - In
System variables, double-click onPath(or single-click, and click onEdit…) to examine (and, if necessary, edit) the variable. You have to make sure that these directories are defined in the Path variable:
C:\WINDOWS\system32;C:\WINDOWS
The path is now managed by Windows 7 and not the autoexec.bat or autoexec.nt files. To change the system environment variables, follow the below steps.
From the desktop, right-click My Computer and click Properties. In the System Properties window, click on the Advanced tab. In the Advanced section, click the Environment Variables button. Finally, in the Environment Variables window (as shown below), highlight the Path variable in the Systems Variable section and click the Edit button. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.
This is the default PATH environment variable setting on fresh install of Windows 7
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\ After editing the variable PATH a trillion times, I had to correct the variable pathtext to read .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC instead of COM;EXE;BAT;CMD;VBS;VBE;JS;JSE;WSF;WSH;MSC. The difference the was the . (period) in front of the extensions. Wow!
The problem is environmental variable ,Solve the problem as following steps if path is not exist C:\Windows\System32 in environmental variable add in environmental variable C:\Windows\System32 then reboot your machine.am sure you will get solution
Just to add on to above mentioned comment from DavidPostill and user470866!
I ran into the same problem and looking into the PATH variable checked if the default values are there! e.g.: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
However, I noticed that the PATH variable was not starting with them but with some Java and Oracle references, hence I cut and copied the default one to the beginning of the line, e.g.: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\ in the beginning followed by all other stuff which was added by installed programs and saved and all of a sudden all my failing commands in CMD started working again.
Just an idea if anyone runs into this - apparently the order of the values in the PATH variable matters.
Thank you all for your guidance - it was extremely helpful!