0
0
PowershellDebug / FixBeginner · 4 min read

How to Fix 'Command Not Found' Error in PowerShell

The command not found error in PowerShell happens when you try to run a command that PowerShell cannot locate. To fix it, ensure the command is spelled correctly, the executable is installed, and its folder is included in the PATH environment variable.
🔍

Why This Happens

This error occurs because PowerShell cannot find the command you typed. It might be due to a typo, the program not being installed, or the program's folder not being in the system's PATH. PowerShell looks for commands in specific folders listed in PATH. If the command is outside these folders, PowerShell won’t find it.

powershell
notepadtt
Output
notepadtt : The term 'notepadtt' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
đź”§

The Fix

Check the spelling of the command first. If it is correct, make sure the program is installed on your computer. Then, verify that the folder containing the program is in your PATH environment variable. You can add the folder to PATH temporarily in PowerShell or permanently via system settings.

powershell
notepad
Output
A new Notepad window opens (no error).
🛡️

Prevention

Always double-check command spelling before running. Install required programs properly. Keep your PATH environment variable updated to include folders of frequently used commands. Use PowerShell's Get-Command to verify if a command exists before running it.

powershell
Get-Command notepad
Output
CommandType Name Version Source ----------- ---- ------- ------ Application notepad.exe 10.0.19041.1 C:\Windows\System32\notepad.exe
⚠️

Related Errors

Other similar errors include:

  • "The term is not recognized as a cmdlet": Happens when PowerShell commands or scripts are missing or misspelled.
  • "File not found": When a script or executable path is incorrect.
  • "Access denied": When you lack permission to run a command.

Quick fixes involve checking spelling, verifying paths, and running PowerShell as administrator if needed.

âś…

Key Takeaways

Check command spelling carefully to avoid 'command not found' errors.
Ensure the program is installed and its folder is in the PATH environment variable.
Use Get-Command to verify if PowerShell recognizes a command before running it.
Keep your PATH updated to include folders of your commonly used executables.
Run PowerShell as administrator if you encounter permission-related errors.