Commands not recognized as an internal or external command in Command Prompt

When you run a command-line in a Command Prompt window, the following error may appear:

'help' is not recognized as an internal or external command, operable program or batch file.

command prompt commands not recognized

This happens even if the respective executable file is located in the Windows or System32 folder, such as help (help.exe), xcopy (xcopy.exe), findstr (findstr.exe), etc. However, you can run the file by mentioning the full path — e.g., c:\windows\system32\help.exe.

The internal commands, such as cd, md, del, copy, and erase, may work fine.

Cause

The above error occurs if the Windows or Windows\System32 folder is not included in the PATH system environment variable.

By default, in a standard Windows installation, the following folders are included in the System PATH.

  • %SystemRoot%\system32
  • %SystemRoot%
  • %SystemRoot%\System32\Wbem
  • %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
  • %SYSTEMROOT%\System32\OpenSSH\

And the following folder is included in the User PATH:

  • %USERPROFILE%\AppData\Local\Microsoft\WindowsApps

Note: Another possibility is that the C:\Windows and C:\Windows\System32 are pushed to the end of the PATH system environment variable, which can cause problems when running a command in the Command Prompt window.

Resolution

To fix the “not recognized as an internal or external command” error in Command Prompt, add Windows and Windows\System32 to the PATH environment.

Add Windows and System32 to the PATH environment

  1. Right-click Start, and click Run. Type “sysdm.cpl” and click OK. This launches the System Properties dialog.
  2. Select the “Advanced” tab, and click “Environment Variables..”
  3. Under “System variables,” double-click “Path.”
  4. In the “Edit environment variable” dialog, add each of the directories listed above.
    path environment variable - system properties
  5. If you want to add additional folder locations — e.g., “C:\Program Files\Java,” feel free to add them.
  6. Also, if you want, you can configure the user path settings by double-clicking “Path” under “User variables.”
  7. Click OK, OK, OK to close the dialog boxes.
  8. Restart Windows for the changes to take effect for all apps and services.

What if they’re already included in the PATH?

If %SystemRoot%\system32 and %SystemRoot% are already included in PATH and yet the problem occurs, make sure you move the two items to the top of the list.

For example, your PATH variable may look like the following:



Path=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;%C_EM64T_REDIST11%bin\Intel64;C:\Program Files (x86)\Common Files\Microsoft Shared\VSA\10.0\VsaEnv;%INTEL_DEV_REDIST%redist\intel64\mpirt;%INTEL_DEV_REDIST%redist\intel64\compiler;%INTEL_DEV_REDIST%redist\ia32\mpirt;%INTEL_DEV_REDIST%redist\ia32\compiler;C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin;%SYSTEMROOT%\System32\OpenSSH\;C:\Program Files (x86)\CCLRC ISIS Facility\Open GENIE\system;C:\Program Files (x86)\Common Files\Autodesk Shared\;C:\Program Files\dotnet\;C:\Program Files\Atomes;C:\Users\ach25\AppData\Local\Microsoft\WindowsApps;

As you can see, the two entries, %SystemRoot%\system32 and %SystemRoot%, are pushed to the middle/end of the PATH variable. This can cause an error when running a command in the Command Prompt window.

Move Windows and Windows\System32 to the top

To fix the issue,  move Windows and Windows\System32 to the top of the PATH environment variable.

move windows and system32 to the top of the path variable

Ensure that the top 5 items in the system PATH variable are the following:

  • %SystemRoot%\system32
  • %SystemRoot%
  • %SystemRoot%\System32\Wbem
  • %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
  • %SYSTEMROOT%\System32\OpenSSH\

Additionally, you may want to remove obsolete entries, if any, from the PATH variable.

After moving the stock entries to the top, the dialog appears like below:

move windows and system32 to the top of the path variable

That should do the trick!


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

Leave a Reply