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?

share|improve this question
1 
Please type "echo %path%" and give the output. It seems that your PATH environment variable is corrupt (cd, dir, set are built into cmd.exe, programs like shutdown, ipconfig, ping are external programs and not builtin, therefor cmd.exe needs to have a good PATH variable to find the programs).– Werner HenzeNov 7 '13 at 12:25
1 
This might be a reason for not having c:/windows/system32 folder in the path. Open command prompt. Enter path command. See whether it contains c:\windows\system32 is in it or not. If not add it. You can use all the above mentioned commands.– Vanga SasidharNov 7 '13 at 12:25
   
@WernerHenze This is what i get %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbe‌​m;%SYSTEMROOT%\Syste m32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C :\Program Files\Java\jre7\bin;– user264958Nov 7 '13 at 12:27
   
@PreciousTijesunimi Is SystemRoot set correctly ("echo %SystemRoot%")?– Werner HenzeNov 7 '13 at 12:28
   
There is a gap on the second line:`%SYSTEMROOT%\Syst‌​e m32\WindowsPowerShell\v1.0` between the Syste and the m. You maybe should fix that.– Christian WoerzNov 7 '13 at 12:35

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.

share|improve this answer
   
Upvote because this is a very good point and it fixes the real cause.– Werner HenzeNov 7 '13 at 12:37

Maybe the environment variables aren't set the right way:

  1. Right click ComputerPropertiesAdvanced System SettingsAdvanced (tab) → Environment Variables…
  2. In System variables, double-click on Path (or single-click, and click on Edit…) to examine (and, if necessary, edit) the variable.
  3. You have to make sure that these directories are defined in the Path variable:

    C:\WINDOWS\system32;C:\WINDOWS
share|improve this answer
   
This is only true if windows is installed to C:\windows. The correct (out-of-the-box) setting is %SystemRoot%\system32.– Werner HenzeNov 7 '13 at 12:30
   
Wow!!!. Thanks, I added the path to it and its now working perfectly– user264958Nov 7 '13 at 12:31
1 
@PreciousTijesunimi Glad I could help. You may accept the answer, so that other people can find the solution easier. :)– Christian WoerzNov 7 '13 at 12:32
   
@PreciousTijesunimi "%SystemRoot%\system32" is in your path, so please check %SystemRoot% - if it is wrong, then it should be set correctly and not a workaround with adding C:\windows\system32.– Werner HenzeNov 7 '13 at 12:33
   
@WernerHenze Those were there before and were not wrong but the commands were still not working. I added what is in the answer and they are now working– user264958Nov 7 '13 at 12:36

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\
share|improve this answer

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!

share|improve this answer

Your Answer

 
discard

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