What Is the Windows PATH and How Do You Add Things to It?

Windows Path Feature

The most efficient way to get most things done on Windows is via the graphical interface. Every now and then, though, you have to turn to the command line for troubleshooting, programming, or just working on your nerd cred. But if you’re trying to run something that’s not natively part of Windows, you’ll need to add it to your PATH variable. That tells your system where to look for executables when you ask for them.

What is PATH?

Environment variables store data about a system’s environment so the system knows where to look for certain information. The PATH variable is one of the most well-known environment variables since it exists on Windows, Mac, and Linux machines and does a fairly user-facing job on all. Its actual form is just a text string containing a list of directory paths that the system will search every time you request a program.

Windows Path Python Example

This is a bit like adding a desktop shortcut to your command line. Instead of entering “C:\Users\username\AppData\Local\Programs\Python\Python38-32\python.exe” to launch Python, you can add the folder containing the file to the PATH variable and just type “python” to launch it in the future. Do that for any program you like, whether it launches a GUI (like Notepad) or works in the command line interface (like Python).

Windows Path Charmap Launch

On Windows, PATH (capitalized by convention only, since Windows’ NTFS file system is not case-sensitive) points by default to the “C:\Windows” and “C:\Windows\system32” directories. If you type charmap into the command line, you’ll get a massive list of Unicode characters you can copy and use, for example. “notepad” runs Notepad, “msinfo32” gets you a list of your computer’s specs, and so on.

These programs can also be launched with the GUI. But if you’re already working in the command line, launching programs just by typing their names is a lot easier. This is especially true if you’re trying to launch a program that will open and run inside the command line interface, like Python or Node.js.

How do I edit the PATH variable?

The Windows GUI is pretty straightforward, so it’s probably the best way for most people to edit PATH.

Using the Windows GUI

1. Open “System Properties” and go to the “Advanced” tab. The easiest way to do this is by typing environment variable into your Windows Search bar and clicking “Edit the system environment variables.”

Windows Path System Properties Search

Alternatively, you can go to “Control Panel -> System and Security -> System” and click “Advanced system settings;” type sysdm.cpl into the Run command; or right-click “This PC,” select “Properties,” and click “Advanced system settings.” They all go to the same place.

2. Once you’re in the “Advanced” tab, click “Environment Variables … ”

Windows Path System Properties Advanced

3. The top box contains user variables, meaning any edits will only apply to your account. If you have multiple accounts on one machine and want the changes to affect everyone, edit the bottom box containing system variables instead.

Windows Path Environment Variables

4. Select the user or system Path variable (don’t let the title-case throw you; PATH and Path are the same in Windows) you want to edit and click the “Edit … ” button below the box.

Windows Path Edit Environment Variable

5. If you already have the path to the folder you want to add, just click “New” and paste in the full path (not directly to the executable, just to the folder containing it). I’m pasting in the path to my NodeJS directory so I can use JavaScript in the command line.

Windows Path Edit Environment Variable New

6. If you’d rather browse to the folder and select it manually, use the “Browse” button to navigate to the folder where your executable is located and hit the “OK” button when you’re there.

Windows Path Edit Environment Variables Browse Node

7. If you want your program to launch slightly faster, you can use the “Move Up” and “Move Down” buttons to put its folder closer to the top so it’ll pop up more quickly in the directory search.

8. Open a new command-prompt window and test your program by typing in the name of the executable you want to launch. It won’t work in the current window since it’s still using the old PATH variable.

The Windows 10 GUI is very usable and should meet most peoples’ needs, but if you need to use the command line to set PATH, you should be aware that it’s not as straightforward as it seems. It’s a good idea to read through the known issues with and fixes for the setx command truncating the variable to 1024 characters or otherwise altering the variables. Definitely back up both your user and your system path variables first.

Windows Path Cmd Setx

With that disclaimer, you can use the following code to set your System PATH from the Command Prompt. (Run as administrator.) To use it to set your User PATH , just remove the /M.

Do I need to edit PATH?

Chances are, if you’re reading this, you’ve run into something that requires you to add it to the PATH variable, so that’s probably what you should do. If you just want to add something to your PATH for easier access, though, that’s also fine. Just make sure it doesn’t interfere with the higher-priority programs.

If you need to work with environment variables regularly and want something with a little more power than the default Windows GUI or command line, the Rapid Environment Editor tool works quite well. It even includes tools to help you remove duplicate and/or broken paths. Just remember to back up your computer first before you make any changes.


Andrew Braun Andrew Braun

Andrew Braun is a lifelong tech enthusiast with a wide range of interests, including travel, economics, math, data analysis, fitness, and more. He is an advocate of cryptocurrencies and other decentralized technologies, and hopes to see new generations of innovation continue to outdo each other.