Environment variables are name-value pairs for various programs or processes on an operating system. On Windows, the environment variables store all sorts of information about the operating system environment, such as its path, location of system programs and processes, and other essential data required by other system programs.

setting path variable in windows

Of the different kinds of Windows environment variables, one that plays an important role—and impacts the way programs and commands get executed—is the PATH environment variable.

If you’re wondering why you’d want to set the PATH variable and how to do it, here’s a guide explaining the same in detail.

Why Would You Want to Set the PATH Variable?

PATH is an essential environment variable on all Windows operating systems. It determines the way a system executes a program or command on your computer.

Typically, when you have to launch a program or execute a command, you have two options. Either you can navigate to the directory where the program/command is stored and execute it from there. Or, you can use the absolute path for that program/command in the file system to run it from anywhere.

While both approaches let you execute programs or commands via the CLI (Command Prompt or PowerShell), they aren’t very efficient. A better solution here is to set the PATH variable for those programs or commands in the environment variable so you can access them from anywhere on the file system hierarchy.

For example, with Python installation, unless the installer gives you an option to set the PATH automatically, you have to do it explicitly to use Python within any directory on your system. Although this is an optional step, it’s highly recommended that you do so to alleviate the need for using absolute (full) paths while running Python scripts.

How to Set the PATH Variable

PATH variables can be specified via both GUI and CLI methods, and the steps involved are mostly the same for all Windows versions. The following is a breakdown of these steps to guide you in the process.

Setting the PATH Variable Using GUI

Using the graphical interface is the easiest way to set the PATH variable in Windows. To do this, first, open the Windows Run prompt by hitting the Windows + R key shortcut.

Next, in the field beside Open, type in sysdm.cpl and press Enter or click OK to open System Properties.

In System Properties, go to the Advanced tab and click on the Environment Variables button at the bottom.

setting the path variable in windows

On the Environment Variables window, you’ll see two sections: one for user variables and the other for system variables. System variables are accessible to all system users, whereas User variables are specific to only the current user. So depending on which variable type you want to modify, you need to click on Path in the appropriate section.

Now, open File Explorer and head to the installation directory of the program you want to add to PATH. Press and hold the Shift key, right-click on the folder, and select Copy as Path.

In the Environment Variables window, click on the Path variable name from either section and hit the Edit button. On Windows 7 and Windows 8, add a semi-colon at the end of the line, and without leaving a space, paste the program’s path you just copied into the Path field.

setting the path variable in windows

If you’re on Windows 10, hit the New button and paste the copied path on the new line. Alternatively, hit the Edit text, add a semi-colon to the end of the field for Variable value, and paste the program’s path.

setting the path variable in windows

Hit OK.

Setting the PATH Variable Using CLI

While the GUI method is easier to follow and sets the PATH variable permanently, it involves several steps. So if you want to save yourself the hassle of clicking through various menu windows, you can set PATH via the command line using the PATH command.

For this, first, fire up Command Prompt with administrator privileges. To do this, hit the Windows + X shortcut key to open the Power User Menu and select Command Prompt (Admin) from the available options. Hit Yes in the User Account Control. If you’re on Windows 7 or Windows 8, hit the Windows key, search Command Prompt, and hit the Ctrl + Shift + Enter shortcut to open it with administrator rights.

In the command window, enter your command using the following command syntax to set a variable:

set PATH=”value”

…where value is the path of the program in the file system you want to add.


set PATH=”C:\Program Files\Android\Platform-Tools”

However, this command sets PATH temporarily (only for the current session) and resets it to the default PATH entries upon system reboot.

So, if you’d like to set PATH for a program permanently—such that it persists even after rebooting the PC—you need to use the setx command.

Following is the syntax to use it:

setx PATH "value;%PATH%"


setx PATH "C:\Program Files\Android\Platform-Tools;%PATH%"

Do note that this will set the PATH variable for the local environment (the current user). If you’d like to do this system-wide, you need to use the /m parameter. For this, in an elevated Command Prompt, run the following command:

setx /m PATH "C:\Windows\System32;%PATH%"

Once done, restart CMD.

Lastly, to verify if your PATH has been added successfully, run the following command in CMD:

echo %PATH%

How to Unset the PATH Variable

For some reason, if, after you’ve set the PATH variable, you want to unset it, you can do so using the following steps.

Open Run and enter:


In System Properties, tap on the Advanced tab and click the Environment Variables button at the bottom. Next, click on the Path entry from either section in the Environment Variables window—depending on whether you set the PATH temporarily or permanently—and hit the Edit button.

Tap on the entry you want to remove to select it and hit the Delete button on the right. On older versions of Windows, you can click the Edit text button and delete the recent PATH entry for the Variable value text field.

setting the path variable in windows

Hit OK to save the changes.

Running Programs/Commands From Anywhere With the CLI

Once you’ve set the PATH variable on your computer to include the path (or directory) of the program or command you want to execute from any directory, you can easily run it from Command Prompt or PowerShell without ever having to specify its absolute path.

FAQs About Setting the PATH Variable in Windows

1. How do I set the PATH variable in Windows 10?

On Windows 10, you can set the PATH variable either using the GUI or CLI. With GUI, you need to go into the Environment Variables settings and set/modify the PATH variable from there, whereas in the CLI approach, all you need to do is run a couple of commands in the CMD prompt, and you’ll have the PATH variable for your desired program set.

So depending on which method you find easier to follow, follow the steps listed earlier in the guide to set the PATH variable on your Windows 10 PC.

2. Does Windows have a PATH variable?

All Windows operating systems have the PATH variable as part of the environment variables, and by setting it for your most frequently used programs or commands, you can launch them from any directory in the file system without having to specify their absolute path.

3. How do I permanently set a PATH variable?

Permanently setting a PATH variable is possible via both GUI and CLI methods. With the GUI method, you’ll have to go into the Environment Variables setting and set the PATH for your program or command there. On the other hand, the CLI method simplifies this process and only involves using a command (setx) in the Command Prompt, which saves you the hassle of clicking through various menus.

4. How do I find my PATH in CMD?

To find the PATH variable on your Windows PC, open the Command Prompt with administrator privileges and run echo %PATH%.

Was this article helpful?