You install Python, Java, or Node, type python in a terminal, and get the message that it is not recognized as an internal or external command. The first thought is usually a broken install. Far more often the PATH environment variable simply does not include the folder where the program lives. This guide covers how to open environment variables, how to add or edit PATH safely, and the order to follow when a command still cannot be found.
What Are Windows Environment Variables and PATH
Environment variables are a set of global key value pairs that Windows hands to the system and to programs. PATH is the important one, a list of folder paths separated by semicolons. When you type a command such as python, the shell walks the PATH entries in order and looks in each folder for a matching executable.
If nothing matches, you get the not an internal or external command error. Adding the program folder to PATH lets you run it from any directory instead of typing the full path every time. To see the current value, run echo %PATH% in cmd, or $env:PATH in PowerShell.
Variables come in two scopes. User variables apply to the current account, system variables to every account. For day to day PATH edits, change the user variable. The change is smaller and easier to undo.
What It Does
- Make a command usable from any directory, so a newly installed tool does not require a
cdinto its install folder. - Set lookup priority. Earlier PATH entries are searched first, which decides which version wins when two are installed on the same machine.
- Keep scripts portable by referencing a variable instead of a hard coded absolute path.
- Separate scopes. User variables affect one account, system variables the whole machine.
- Pass configuration to programs. Tools read variables such as
JAVA_HOME. - Point temporary files elsewhere.
TEMPandTMPdecide which drive caches land on. - Test changes safely. Append a path in one window first, then make it permanent once it works.
When to Use
- Right after installing Python, Java, Node, or Git, when their commands do not respond.
- An installer skipped the Add to PATH checkbox and you need to add it by hand.
- Several versions of the same tool are installed and you want to pick the default.
- A script calls a third party command line tool and you need to confirm it is reachable.
- The C drive is short on space and you want temporary files on another partition.
- You inherited a machine and want to see exactly which paths are configured.
Before You Start
The graphical dialog is the safest route, while command line methods suit bulk deployments. Editing system variables needs administrator rights; editing user variables does not. Every change applies only to command windows opened afterwards, which is the step people miss most often.
| Item | Windows 10 | Windows 11 |
|---|---|---|
| Graphical entry | Win + R then sysdm.cpl | Same, or search environment variables in Settings |
| Environment Variables dialog | Advanced > Environment Variables | Same |
User Path variable | Editable | Editable |
System Path variable | Needs admin | Needs admin |
| Permanent write from CLI | setx | setx |
Step-by-Step
- Press
Win + R, typesysdm.cpl, and press Enter. Switch to the Advanced tab and click Environment Variables at the bottom right. - In the user variables section, find the row named
Path, select it, and click Edit. The name is not case sensitive. If there is no such row, click New and create it. - Click New and paste the program folder, for example
C:\Python312or the Python path under your user profile. Paste the folder itself, not the executable file name. - If the executable sits in a subdirectory, add that subdirectory as a separate line too, such as
C:\Python312\Scripts. Tools installed by pip usually land there. - Click OK through the dialogs, then close every open
cmdand PowerShell window and open a fresh one. Old windows do not refresh on their own, so this step cannot be skipped. - Run
echo %PATH%to confirm the new folder is in the list, thenwhere pythonto see which executable Windows actually resolves to. - For a one off test, run
set PATH=%PATH%;C:\SomeFolderin the current window. It dies when the window closes and writes nothing to the system. For anything permanent, go back to the dialog instead.
FAQ
PATH changed but the command is still not found
Open a new command window first, since old ones read the old value. Then check that you entered the folder containing the .exe, not a parent folder or the file name.
PATH got shorter after using setx
setx has a 1024 character limit and truncates longer values, and it does not refresh windows that are already open. Use the graphical dialog when PATH is already long.
I accidentally cleared the whole PATH
Rebuild it under system variables with at least C:\Windows, C:\Windows\system32, and C:\Windows\System32\Wbem, or a large number of system commands stop working.
Is a missing MSVCP140.dll a PATH problem
No. That is a missing runtime library, unrelated to path lookup. See Missing MSVCP140.dll or 0xc000007b When Launching Software.
How It Works
Every process inherits a copy of an environment block from its parent, and PATH lives inside it. When the shell receives a command with no path attached, it joins the file name to each PATH entry from left to right and tries to execute it. The first match wins, which is why order decides which program of the same name runs.
That also explains the mandatory new window. An already running cmd still holds its old copy. The values themselves live in the registry, and the graphical dialog just reads and writes them. The editor in How to Use the Registry Editor (regedit) and Group Policy (gpedit) on Windows 11 can change them too, at a higher risk.
Conclusion
Configuring PATH is simply telling Windows which folders to search for executables. Watch for the Add to PATH option in installers, since it removes most of the manual work, then reopen the terminal and verify with where. If command line basics are fuzzy, CMD Command Prompt and Run Commands (Win+R) Cheat Sheet fills in the gaps. A quick where after every install is a habit that pays off, and it takes one line.