Skip to content

/errors/cmd/is-not-recognized-as-an-internal-or-external-command

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

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
tool
Command Prompt (cmd)
exit code
9009
versions
Windows 10, Windows 11, Windows Server 2016+
os
windows

'nosuchtool' is not recognized as an internal or external command, operable program or batch file. means cmd could not find anything to run under that name. It is not a built-in command (dir, copy, set …), and no file with that name plus one of the PATHEXT extensions (.COM;.EXE;.BAT;.CMD;…) exists in the current folder or in any folder listed in PATH. %ERRORLEVEL% is set to 9009. Most of the time the program is not installed or its folder is not in PATH.

Reproduce it

cmd
nosuchtool --version 2>&1
echo ERRORLEVEL=%ERRORLEVEL%
mkdir tools
> tools\hello.cmd echo @echo hello from tools
hello 2>&1
set "PATH=%CD%\tools;%PATH%"
hello
echo ERRORLEVEL=%ERRORLEVEL%

Output

'nosuchtool' is not recognized as an internal or external command,
operable program or batch file.
ERRORLEVEL=9009
'hello' is not recognized as an internal or external command,
operable program or batch file.
hello from tools

The first call to hello fails because tools is not in PATH; after prepending the folder for this window, the same name runs.

Find out why

cmd
where nosuchtool
echo %PATH%
echo %PATHEXT%

where searches the current folder and every PATH entry the same way cmd does and prints each match (or INFO: Could not find files for the given pattern(s).). If where finds the file but typing the name fails, check that the extension is in PATHEXT.

Fixes

  1. Install the program or repair its installation; many installers have an "Add to PATH" option (Git, Python, Node.js).
  2. Open a new window. A running cmd keeps the environment it started with. Changes made with setx or in System Properties > Environment Variables only reach windows opened afterwards (and programs started from them, such as a new VS Code terminal).
  3. Add the folder to PATH, for this window only or permanently. See set the PATH environment variable.
  4. Use the full path: "C:\Program Files\Tool\tool.exe" --version.
  5. PowerShell commands do not exist in cmd. ls, cat, Get-ChildItem are PowerShell; in cmd use dir, type, or run powershell -Command "...".

Sources