Windows shows 'name' is not recognized as an internal or external command, operable program or batch file. when cmd.exe cannot resolve what you typed to a built-in command, an executable, a batch file, or another recognized command extension.
The cause is often a missing or incorrect PATH entry, but not always. A misspelled command, a newly changed environment variable, an unescaped character such as &, or confusion between Command Prompt and PowerShell can produce the same message.
Start with these quick checks
- Confirm the command is spelled correctly.
- Check whether the program is installed.
- Try the executable by its full path.
- Inspect
PATHin the same terminal where the error appears. - If you recently changed an environment variable, close that terminal and open a new one.
In Command Prompt, run:
set PATH
path
set PATH displays variables whose names begin with PATH. path displays the current command search path. To see every environment variable available to that cmd.exe process, run:
set
In PowerShell, display the current process’s PATH with:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
$Env:PATH
Do not use %PATH% as PowerShell syntax. That is the Command Prompt form; PowerShell uses $Env:PATH.
What the error actually means
cmd.exe has two broad types of commands:
- Internal commands: built into
cmd.exe, such ascd,set, andpath. - External commands: programs or command files found in the current directory or through the directories listed in
PATH.
For an external command, Windows searches the current directory and then the directories in PATH. If more than one matching command exists, the current directory is considered first; among PATH directories, an earlier entry takes precedence.
When you type a name without an extension, cmd.exe uses its executable-extension lookup order. The default order is:
.exe.com.bat.cmd
For example, if a directory contains both acct.exe and acct.bat, typing acct selects acct.exe. Typing acct.bat explicitly selects the batch file.
Free tools Windows power users keep installed
One-click scans. No signup required.
1. Check that the program is installed
A PATH repair cannot fix a program that is not installed. Look for the executable in its installation directory, or try launching it from File Explorer.
For example, if the program is actually located at C:Toolsapp.exe, test it directly:
C:Toolsapp.exe
For a path containing spaces, quote the complete executable path:
"C:Program FilesToolsapp.exe"
If the full path works but typing only app does not, the program is present and the likely problem is PATH. Add the directory containing the executable—not the executable filename itself—to PATH.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstall2. Add the program to PATH for the current Command Prompt
This temporary fix is useful for testing. It affects only the current Command Prompt window and programs launched from it:
set PATH=%PATH%;C:Tools
Now try the command again:
app
The semicolon separates PATH entries. The new entry must be a directory:
C:Tools
Do not add:
C:Toolsapp.exe
If the command works after the temporary change, you have confirmed that the permanent PATH does not contain the correct directory. This set command does not change the user or system environment stored by Windows. Closing the window removes the change.
3. Add the directory to permanent PATH through Windows
Use the graphical environment-variable editor when you want the setting to survive new terminals and reboots.
Recommended Free Tools
- Open System Control Panel.
- Select System.
- Select Advanced System Settings.
- On the Advanced tab, select Environment Variables….
- Under User variables or System variables, select Path and choose Edit.
- Select New and enter the directory containing the executable, such as
C:Tools. - Confirm each dialog with OK.
Choose User variables for a program installed only for your account. Choose the System variables PATH when every user on the computer needs the command. Editing system variables normally requires administrator permission.
Open a new Command Prompt after saving the change:
path
app
Existing Command Prompt windows, PowerShell sessions, Windows Terminal processes, and applications keep the environment block they inherited when they started. A new terminal must be launched to receive the updated PATH.
4. Check for a malformed SET command
The error can be caused by the command used to set a variable rather than by PATH. In cmd.exe, characters including <, >, |, &, and ^ have special meanings.
This command is unsafe:
set Variable=New&Name
The ampersand ends the first command. Command Prompt then attempts to run Name as a second command, which can produce the “not recognized” message.
Rank #3
Escape the ampersand with a caret:
set Variable=New^&Name
Alternatively, quote the value:
set Variable="New&Name"
With the quoted form, the quotation marks become part of the variable’s value. Use the escaped form if you do not want those quotation marks stored.
5. Do not confuse SET, SETX, and PowerShell syntax
Command Prompt: temporary value
set PATH=%PATH%;C:Tools
This changes the current cmd.exe process and its child processes only.
PowerShell: temporary value
$Env:PATH += ';C:Tools'
This changes only the current PowerShell process and programs started from it.
SETX: persistent value for future terminals
setx VARIABLE value
For a machine-wide value:
setx VARIABLE value /m
setx writes a persistent user or machine value, but it does not update the current terminal. Open a new Command Prompt or PowerShell session before testing the result.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsAvoid using this as a general PATH repair:
setx PATH "%PATH%;C:Tools"
Microsoft documents two serious risks:
setxexpands variable references before writing the value.- It has a 1,024-character assignment limit. A longer resulting PATH can be truncated, removing existing directories.
It can also destroy deferred references. If PATH contains %JAVADIR%, using setx on PATH stores the current expanded value instead of preserving the reference for later changes.
Use the Environment Variables interface for PATH changes. If you need a PowerShell command for a specific variable, the persistent forms are:
[Environment]::SetEnvironmentVariable('Foo', 'Bar', 'User')
[Environment]::SetEnvironmentVariable('Foo', 'Bar', 'Machine')
The Machine form requires permission. Setting a User- or Machine-scope value to an empty string removes it from that scope.
6. Check command precedence and duplicate installations
You may have installed the correct program but be running another copy with the same command name. Because the current directory is searched first, and earlier PATH entries take priority, duplicate installations can produce surprising results.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Inspect PATH carefully with:
path
Look for:
- A missing directory.
- A misspelled directory.
- An old installation listed before the new one.
- A directory that no longer exists.
- An accidental executable filename instead of its containing directory.
Removing obsolete entries can also avoid launching an unintended version. Be careful not to delete entries used by other software.
7. Account for file extensions and scripts
If the file is a batch file, try its extension explicitly:
build.bat
build.cmd
If the command is a PowerShell script, adding .ps1 to PATH does not solve the problem. A script’s directory still needs to be the current directory or be referenced according to PowerShell’s command lookup rules. In practice, use an explicit path when appropriate, for example:
.build.ps1
PowerShell scripts do not require adding .ps1 to PATHEXT.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Nonstandard script extensions are different. Executing them can require a file association registered with the assoc and ftype commands from Command Prompt. Adding the extension to PATH alone does not create the required file handler.
8. Check environment-size problems
Windows limits an individual environment variable to 8,192 bytes and the total environment for a process to 65,536 characters, including variable names, values, and equal signs.
An excessively long PATH can therefore cause problems even when its entries look correct. Remove stale directories and duplicate entries rather than repeatedly appending new ones. Avoid blindly copying a PATH from another computer or using commands that rewrite the entire value.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.A practical diagnosis sequence
Use this sequence when you need to identify the cause instead of guessing:
Best Value
- Run the command again and note the exact token Windows says is not recognized.
- Check spelling and whether the command should be run in Command Prompt or PowerShell.
- Run the program using its full quoted path.
- If that works, temporarily append its directory with
set PATH=%PATH%;C:directory. - If the temporary fix works, add that directory to the appropriate User or System PATH through Environment Variables.
- Close every affected terminal and open a new one.
- If the problem began after a
setcommand, inspect special characters such as&and|. - Inspect duplicate and stale PATH entries, command extensions, and unusually large environment values.
Examples of common mistakes
| Symptom | Likely cause | Correction |
|---|---|---|
tool fails, but C:Toolstool.exe works |
C:Tools is not in PATH |
Add the directory, then open a new terminal |
| PATH was edited, but the old terminal still fails | The terminal inherited the old environment | Start a new Command Prompt, PowerShell session, or Windows Terminal process |
A variable assignment involving & produces an extra command error |
The ampersand was parsed as a command separator | Use ^& or quote the value |
| A command runs, but it is the wrong version | Another copy appears earlier in the search order | Review PATH order and the current directory |
setx PATH ... removes old tools |
The value was truncated or variable references were expanded | Restore PATH through Environment Variables; avoid using SETX for general PATH editing |
FAQ
Does this error always mean PATH is wrong?
No. PATH is a common cause, but a misspelled command, a missing installation, an unescaped special character in a SET command, an incorrect shell, or a command-extension issue can produce the same message.
How do I check PATH in Command Prompt?
Run path to display the command path, or run set PATH to display PATH-related variables. Run set to display the complete environment for the current Command Prompt.
Why did my PATH change not work?
A temporary set change applies only to the current window. A graphical environment-variable change is inherited only by newly started terminals and applications. Close the old terminal and open a new one.
Is SETX safe for fixing PATH?
It is risky for general PATH editing. SETX does not update the current terminal, expands variable references, and has a 1,024-character assignment limit that can truncate PATH. Use the Environment Variables interface instead.
What is the difference between User PATH and System PATH?
User PATH applies to your account. System PATH applies to all users and generally requires administrator permission. Use User PATH for a per-user installation and System PATH when all users need the command.
Why does a PowerShell script still fail after I add .ps1 to PATH?
Adding the extension is not the relevant fix. The script’s directory must be current or explicitly referenced according to PowerShell lookup rules. From the current directory, use a path such as .script.ps1.
The Bottom Line
First prove that the program exists by running its full path. If that works, inspect PATH, add the containing directory—not the executable—to the appropriate User or System variable, and open a new terminal. Use set for a temporary Command Prompt test, avoid rewriting PATH with setx, and check for special-character parsing when the failure follows a variable-assignment command.

