The Categorizer

the categorizer logo

How To Set PATH and Environment Variables in Windows (3 Ways)


Path variables are environment variables that provide the location of a program. The default path variable system in Windows determines the folder where files are looked for. C:\Program Files, C:\Program Files (x86), C:\Users, and any additional directories on your hard disc fall under this category.

Using the methods below, you’ll be able to insert any programming language, compilers, and security keys (python, PHP, c++ compilers, etc) to the path variable in Windows OS. By the end of this article, you’ll be able to add environment variables in Windows 11:


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 Command Line Interface (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.


Step 1: In the Start menu, type: “Edit the system environment variables” (without quotation marks) and hit the enter key.

type "edit the system environment variables" in start menu
Edit System Environment Variables

Step 2: Select the “Advanced” tab from the top bar and select the “Environment Variables” button.

click the environment variables button in the advanced tab in advanced system properties
“Environment Variables” Button

Step 3: Double click the “Path” variable in the System Variables section.

click the "path" option under the system variables settings in environment variables settings
“Path” Option

Step 4: Click the “New” button, enter the file path and click the “OK” button.

click the "new" button and add environment variable in system variables settings and click the "ok" button
“New” Button > “Add” Environment Variable

Step 5: Restart your computer to make changes take effect.
Also, you can refresh environment variables without rebooting your system.

restart device to make changes take effect in windows
Restart the Device

Step 1: Open the Command Prompt from the Start Menu as an administrator.

command prompt icon in windows 11
Command Prompt (CMD) Icon

Step 2: To list all the path variables type the following command:
“echo %PATH%” or “PATH” (without quotation marks).

list the available path variables in windows using command prompt
List PATH Variables

Step 3: To add another variable in the path directory, type the command:
setx PATH “%PATH%;C:\Variable\Path\Here“.

set envirnoment variables in windows with setx command
Set Environment Variables with “Setx” command

Step 4: Restart your computer to make changes take effect.
Also, you can refresh environment variables without restarting your PC.

restart device to make changes take effect in windows
Restart the Device

Step 1: Open the Windows PowerShell from the Start Menu as an administrator.

powershell app icon in windows 11
PowerShell App Icon

Step 2: To list all the path variables in the PowerShell, type the command: [Environment]::GetEnvironmentVariable(“PATH”)

list all path variables in windows using PowerShell
List All PATH Variables

Step 3: To declare a PATH variable, type the command:
$Variable_Name = “C:\Path-Here\”

declare new path variable in windows using PowerShell
Declare a New Variable

Step 4: To add the PATH variable using PowerShell, type the following command:
[Environment]::SetEnvironmentVariable(“PATH”, “$PATH;$Variable_Name”)

add new path variable in windows using PowerShell
Add PATH Variable using PowerShell

Step 5: Restart your computer to make changes take effect.

restart device to make changes take effect in windows
Restart the Device

Step 1: Open the Command Prompt or PowerShell from the Start Menu as an administrator.

Step 2: To check if the system variable is properly added, type the command:
“echo %PATH%” or “PATH” (without quotation marks). If the path is added properly, you’ll find the PATH variable in the output.


What is the difference between System and User Variables?

The system variables are shared and apply to all users on the computer, whereas the user variables are unique to each profile. For example, you’ve two users on your computer User 1 and User 2. When you add a system variable in User 1’s account, it will also be set in User 2’s account. However, if you set user variable for User 1. it’ll be applicable for it only.


Next Steps

We’ve covered how to set path and environment variables in Windows 11, and the difference between system and user variables in Windows.

PATH can be included in any of the system or user variables. Make sure to restart the computer to refresh the environment variables and make changes take effect. Further, customize the computer’s settings depending on your preferences.


Related Articles

how to refresh environment variables in windows

Refresh System Variables Windows

Refresh the environment variables in Windows without rebooting your computer.

how to use credential manager in windows

Credential Manager in Windows

Manage your web and system passwords in a single place on your computer.

how to disable widgets in windows 11

Disable Widgets in Windows 11

Improve your computer’s performance by disabling the Widgets program.

Take a Minute to Share This Article.