The Categorizer

the categorizer logo

How To Set PATH and Environment Variables in Windows 11

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.

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: Open the Windows Settings from the Start menu.

windows setting app in windows 11
Windows Settings App

Step #2: Select the “System” tab from the left sidebar, scroll and click the “About” button.

click the system button and select the About option in windows settings
About Option

Step #3: Click the “Advanced Settings” button and the system properties panel will appear.

select advanced system settings option in the about section in windows settings
Advanced System Settings

Step #4: 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 settings
“Environment Variables” Button

Step #5: Double click the “Path” variable in the System variables section.

select the "path variables" button under the system variables section
PATH Variable

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

click the new button to add path variables in windows using advanced system settings
Click the “New” button and add a new PATH Variable

Step #7: 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 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 command: PATH

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: PATH %PATH%;C:\Variable-Path-Here\

command to add path variable in windows using command prompt
Add PATH Variable using CMD

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 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 #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 %YOUR_ENV_VARIABLE%

check if path variable is added properly using command prompt
PATH Variable Checking

Note: If the PATH variable is not added properly, then the following warning message will appear:

C:\WINDOWS\system32>echo &C:\Path_Variable%
ECHO is on.
The system cannot find the path specified.

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.

We’ve also covered the difference between system and user variables in Windows. PATH can be included in any of the system or user variables.

Further, customize 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.