Set Up Windows PATH and Environment Variables for Command-Line Tools

  • Start date Start date
  • Reading time 7 min read

Set Up Windows PATH and Environment Variables for Command-Line Tools​

Difficulty: Beginner | Time Required: 15 minutes
If you have ever installed a command-line tool such as Git, Python, Node.js, Java, FFmpeg, ADB, or a compiler and then seen an error like:
'python' is not recognized as an internal or external command
Windows is telling you it cannot find that program from your current command prompt or terminal session. This is usually because the tool’s folder has not been added to the Windows PATH environment variable.
The PATH variable is a list of folders that Windows checks when you type a command. By setting it correctly, you can run tools from Command Prompt, PowerShell, Windows Terminal, scripts, build tools, and development environments without typing the full folder path every time.
This tutorial explains how to view, edit, and safely configure Windows environment variables, especially PATH, on Windows 10 and Windows 11.

Prerequisites​

Before you begin, you should have:
  1. A Windows 10 or Windows 11 PC.
  2. A user account with permission to edit environment variables.
  3. The command-line tool already installed, or at least know the folder path where its executable file is located.
For example, common tool folders include:
Code:
C:\Program Files\Git\cmd
C:\Program Files\nodejs
C:\Python312
C:\Users\YourName\AppData\Local\Programs\Python\Python312
C:\ffmpeg\bin
Tip: The folder you add to PATH should usually be the folder containing the .exe file, not the .exe file itself.

Understanding User vs System Environment Variables​

Windows has two main levels of environment variables:
  1. User variables
    These apply only to your Windows account.
  2. System variables
    These apply to all users on the PC.
For most beginner setups, adding a tool to your User PATH is safer and recommended. It does not require administrator permissions in many cases and reduces the risk of affecting other accounts or system services.
Use System PATH only when:
  • The tool should be available to every user on the PC.
  • You are setting up a shared development machine.
  • The installer or documentation specifically requires it.
  • You understand the impact of changing system-wide settings.
Warning: Be careful when editing PATH. Removing existing entries can break installed applications or development tools.

Step 1: Find the Tool’s Installation Folder​

First, locate the folder containing the command-line program.
For example, if you installed Git, the executable might be in:
C:\Program Files\Git\cmd
If you installed FFmpeg manually, it might be in:
C:\ffmpeg\bin
If you are not sure where the program is installed:
  1. Open the Start menu.
  2. Search for the program name.
  3. Right-click it and choose Open file location.
  4. If it opens a shortcut, right-click the shortcut and choose Properties.
  5. Look at the Target field to identify the actual install location.
You can also search in File Explorer for the executable, such as:
Code:
python.exe
git.exe
node.exe
ffmpeg.exe
adb.exe
Once you find the executable, copy the folder path, not the full file path.
For example, use this:
C:\ffmpeg\bin
Not this:
C:\ffmpeg\bin\ffmpeg.exe

Step 2: Open Environment Variables Settings​

The steps are almost identical on Windows 10 and Windows 11.

Method 1: Using Start Search​

  1. Open the Start menu.
  2. Type:
    environment variables
  3. Select Edit the system environment variables.
  4. In the System Properties window, select the Advanced tab.
  5. Click Environment Variables.

Method 2: Using Run​

  1. Press Windows + R.
  2. Type:
    sysdm.cpl
  3. Press Enter.
  4. Go to the Advanced tab.
  5. Click Environment Variables.
You should now see two sections:
  • User variables for your account
  • System variables

Step 3: Edit the User PATH Variable​

For most command-line tools, edit the User PATH.
  1. Under User variables, select Path.
  2. Click Edit.
  3. In the Edit Environment Variable window, click New.
  4. Paste the folder path for your tool.
Example:
C:\ffmpeg\bin
  1. Click OK.
  2. Click OK again to close Environment Variables.
  3. Click OK to close System Properties.
Note: On modern Windows 10 and Windows 11 versions, the Path editor displays each folder on its own line. On very old Windows versions, it may appear as one long text field separated by semicolons. Windows 10 and 11 users generally get the easier line-by-line editor.

Step 4: Open a New Terminal Window​

Environment variable changes do not always apply to already-open terminal windows.
Close any existing Command Prompt, PowerShell, or Windows Terminal sessions. Then open a new one.
You can test from any of these:
  • Command Prompt
  • PowerShell
  • Windows Terminal
  • Developer Command Prompt, if applicable
For Command Prompt:
  1. Press Windows + R.
  2. Type:
    cmd
  3. Press Enter.
For PowerShell:
  1. Right-click Start.
  2. Choose Terminal or Windows PowerShell.

Step 5: Test the Command​

Now test whether Windows can find the tool.
For example:
git --version
python --version
node --version
ffmpeg -version
If everything is configured correctly, you should see version information instead of an error message.
Example:
Python 3.12.2
or:
git version 2.45.0.windows.1
If the command works, your PATH setup is complete.

Step 6: Add Other Environment Variables If Needed​

Some tools require more than just PATH. They may also need a separate environment variable that points to an installation folder.
Common examples include:
Code:
JAVA_HOME
ANDROID_HOME
ANDROID_SDK_ROOT
GOPATH
For example, Java development tools often use JAVA_HOME.
To create a new user environment variable:
  1. Open Environment Variables again.
  2. Under User variables, click New.
  3. In Variable name, enter:
    JAVA_HOME
  4. In Variable value, enter the Java installation folder, such as:
    C:\Program Files\Java\jdk-21
  5. Click OK.
Then you may also need to add the Java bin folder to PATH, for example:
%JAVA_HOME%\bin
This allows commands such as:
Code:
java -version
javac -version
Tip: Using %JAVA_HOME%\bin in PATH can make future upgrades easier. If Java is later installed in a different folder, you can update JAVA_HOME instead of changing multiple paths.

Step 7: Check Your PATH from the Command Line​

You can view your current PATH from Command Prompt with:
echo %PATH%
In PowerShell, use:
$env:Path
This can help confirm whether your folder appears in the active terminal session.
To find where Windows is resolving a command from, use:
where python
or:
where git
PowerShell also supports:
Get-Command python
These commands are useful if you have multiple versions of the same tool installed.

Tips and Troubleshooting​

The command still is not recognized​

If you still see:
is not recognized as an internal or external command
check the following:
  1. Did you open a new terminal window after editing PATH?
  2. Did you add the folder containing the .exe file?
  3. Did you accidentally add the .exe file itself instead of the folder?
  4. Is there a typo in the folder path?
  5. Does the folder still exist?
  6. Did you edit User PATH but run the terminal as a different user?

The wrong version is running​

If a command works but launches the wrong version, Windows may be finding another copy earlier in the PATH.
For example:
where python
may show multiple results:
Code:
C:\Users\YourName\AppData\Local\Microsoft\WindowsApps\python.exe
C:\Python312\python.exe
Windows checks PATH entries in order. If needed, move the preferred folder higher in the list using the Move Up button in the Path editor.
Warning: Do not randomly delete entries from PATH. Move entries first when possible, and only remove paths you are sure are unnecessary.

PowerShell behaves differently than Command Prompt​

PowerShell and Command Prompt both use environment variables, but their syntax differs.
Command Prompt:
echo %PATH%
PowerShell:
$env:Path
If testing a new command fails in one shell, close and reopen it. If you are using Windows Terminal, close the entire Windows Terminal window and open a fresh session.

Avoid extremely long or messy PATH entries​

Over time, PATH can become cluttered with old software folders. This can make troubleshooting more difficult.
Good practices include:
  • Add only folders you actually need.
  • Remove entries only when you are certain the software is gone.
  • Avoid duplicate entries.
  • Keep development tools organized in predictable locations.

Per-session changes are temporary​

You may see commands online such as:
Command Prompt:
set PATH=C:\Tools;%PATH%
PowerShell:
$env:Path = "C:\Tools;$env:Path"
These only affect the current terminal session. Once you close the window, the change is gone.
For permanent changes, use the Environment Variables window described above.

Conclusion​

Setting up PATH and environment variables is one of the most useful beginner skills for working with command-line tools on Windows 10 and Windows 11. Once configured correctly, you can run tools like Git, Python, Node.js, Java, FFmpeg, and many others from any terminal window without navigating to their installation folders.
A properly configured environment saves time, reduces errors, and makes your Windows PC much more comfortable for development, scripting, troubleshooting, and automation.
Key Takeaways:
  • PATH tells Windows where to look when you type a command.
  • Add the folder containing the tool’s .exe file, not the .exe itself.
  • Use User PATH for most personal development tools.
  • Open a new terminal after changing environment variables.
  • Use where commandname or Get-Command commandname to troubleshoot.
  • Be careful when editing or removing existing PATH entries.

This tutorial was generated to help WindowsForum.com users get the most out of their Windows experience.
 

Back
Top