How to edit path windows

Updated: 12/05/2021 by

Setting the path and environment variables differs depending on the Windows operating system version on your computer. Select a link below for your version of Windows and follow the steps.

Note

Administrator privileges are required to modify the path and environment variables.

Setting the path and variables in Windows 11

  1. Press the Windows key+X to access the Power User Task Menu.
  2. In the Power User Task Menu, select the System option.
  3. In the System > About window, click the Advanced system settings link below the Device specifications section.
  4. In the System Properties window, click the Advanced tab,if not already selected.
  5. Click the Environment Variables button near the bottom-right of the Advanced tab.
  6. In the Environment Variables window (pictured below), highlight the Path variable in the System variables section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each directory path is separated with a semicolon, as shown below.
C:\Program Files;C:\Winnt;C:\Winnt\System32

Windows 10 environmental path settings

  1. After creating or modifying the environment variables, restart the computer for those changes to take effect in Windows.

Note

You can edit other environment variables by highlighting the variable in the System variables section and clicking Edit. If you need to create a new environment variable, click New, and enter the variable name and value.

Tip

To view and set the path through the Windows command line, use the path command.

Setting the path and variables in Windows 10

  1. Press the Windows key+X to access the Power User Task Menu.
  2. In the Power User Task Menu, select the System option.
  3. In the About window, click the Advanced system settings link under Related settings on the far-right side.
  4. In the System Properties window, click the Advanced tab, then click the Environment Variables button near the bottom of that tab.
  5. In the Environment Variables window (pictured below), highlight the Path variable in the System variables section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each directory path is separated with a semicolon, as shown below.
C:\Program Files;C:\Winnt;C:\Winnt\System32

Windows 10 environmental path settings

  1. After creating or modifying the environment variables, restart the computer for those changes to take effect in Windows.

Note

You can edit other environment variables by highlighting the variable in the System variables section and clicking Edit. If you need to create a new environment variable, click New, and enter the variable name and value.

Tip

To view and set the path through the Windows command line, use the path command.

Setting the path and variables in Windows 8

  1. Press the Windows key+X to access the Power User Task Menu.
  2. In the Power User Task Menu, select the System option.
  3. Click the Advanced System Settings link in the left column.
  4. In the System Properties window, click the Advanced tab, then click the Environment Variables button near the bottom of that tab.
  5. In the Environment Variables window (pictured below), highlight the Path variable in the System variables section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon, as shown below.
C:\Program Files;C:\Winnt;C:\Winnt\System32

Windows environmental path settings

  1. After creating or modifying the environment variables, restart the computer for those changes to take effect in Windows.

Note

You can edit other environment variables by highlighting the variable in the System variables section and clicking Edit. If you need to create a new environment variable, click New, and enter the variable name and value.

Tip

To view and set the path through the Windows command line, use the path command.

Setting the path and variables in Windows Vista and Windows 7

  1. On the desktop, right-click the Computer icon and select Properties. If you don’t have a Computer icon on your desktop, click Start, right-click the Computer option in the Start menu, and select Properties.
  2. Click the Advanced System Settings link in the left column.
  3. In the System Properties window, click the Advanced tab, then click the Environment Variables button near the bottom of that tab.
  4. In the Environment Variables window (pictured below), highlight the Path variable in the System variables section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon, as shown below.
C:\Program Files;C:\Winnt;C:\Winnt\System32

Windows environmental path settings

  1. After creating or modifying the environment variables, restart the computer for those changes to take effect in Windows.

Note

You can edit other environment variables by highlighting the variable in the System variables section and clicking Edit. If you need to create a new environment variable, click New, and enter the variable name and value.

Tip

To view and set the path through the Windows command line, use the path command.

Setting the path and variables in Windows 2000 and Windows XP

The path is now managed by Windows 2000 and Windows XP and not the autoexec.bat or autoexec.nt files, as was done with earlier versions of Windows. To change the system environment variables, follow the steps below.

  1. From the desktop, right-click My Computer and click Properties. If you don’t have a My Computer icon on your desktop, click Start, right-click the My Computer option in the Start menu, and select Properties.
  2. In the System Properties window, click the Advanced tab.
  3. In the Advanced section, click the Environment Variables button.
  4. In the Environment Variables window (as shown below), highlight the Path variable in the System Variable section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon, as shown below.
C:\Program Files;C:\Winnt;C:\Winnt\System32

Windows environmental path settings

  1. After creating or modifying the environment variables, restart the computer for those changes to take effect in Windows.

Note

You can edit other environment variables by highlighting the variable in the System variables section and clicking Edit. If you need to create a new environment variable, click New, and enter the variable name and value.

Tip

To view and set the path through the Windows command line, use the path command.

What is the default Windows %PATH%?

The path is based on programs installed on the computer, so there is no «default path.» However, the Windows minimum path is often the path below.

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem

Note

Realize that as you install programs, the path is updated with the paths for the newly installed programs. So, if you have erased your path after installing other programs, those programs may be affected.

Setting path in the MS-DOS and Windows command line

To view and set the path in MS-DOS and the Windows command line, use the path command.

Windows

Overview

In this tutorial, we will learn the steps involved to edit the PATH variable on Windows 11 operating system. PATH is a system environment variable that Windows 11 uses to locate programs from the command line. It is a semicolon-separated string of program directories.

Check PATH variable

To check the PATH environment variable, open the command prompt.

Steps to launch command prompt on Windows 11 PC.

How to launch command prompt on Windows 11

Type the following command.

\> echo %PATH%

PATH variable Windows 11

Edit PATH variable

Click on the Search icon in the Taskbar.

Type Environment in the search bar.

Click on the Edit the system environment variables Control panel item.

Edit Environment Variables Windows 11

##Alternatively,  open the Run command window ( Windows Key + R ) keyboard shortcut.

Type sysdm.cpl and click on the OK button to open the System Properties window.

Environment Variables Windows 11

In the System Properties window, switch to the Advanced tab and click on the Environment Variables… button.

Edit Path Environment Variable Windows 11

Select the PATH system variables and click on the Edit… button. If the PATH environment variable does not exist, click the New… button.

To edit we can change the entities listed in the window screen.

Append to PATH

To append the PATH variable, click on the New button and add the program.

For example, to append JDK bin directory by adding the following entry:

%JAVA_HOME%\bin

We can refer to other system variables with enclosing %. For example, to refer to the path of the Java home directory, we can use %JAVA_HOME%. JAVA_HOME is a system environment variable that we need to set prior to accessing it.

Append to PATH Win11

That’s it. We have successfully appended the JDK directory to the PATH variable.

Windows 11 Tutorials

Windows 11 Tutorials

More Information on Windows 11

https://www.microsoft.com/en-us/windows


Download Article

A simple guide to adding a directory to the Windows 10/11 path variable


Download Article

  • Windows 7–11
  • |

  • Windows XP
  • |

  • Warnings

The PATH environment variable specifies in which directories the Windows command line looks for executable binaries. The process for changing it is not obvious, but it’s not too hard. Read on to learn how to change PATH.

Things You Should Know

  • Adding a directory to your path makes it possible to run programs from the command line without typing the full path.
  • To access your path settings, open Settings, type «path,» then click «Edit the System Environment Details.»
  • While adding directories to the path is simple, don’t remove any existing path directories.
  1. Image titled Change the Path Environment Variable Method2 step1.png

    1

    Open the «settings» application. This can be done by pressing the Windows key and clicking the gear icon in the «Start» menu. You can also search «settings» in Cortana or in the «Start» menu.

  2. Image titled Change the Path Environment Variable Method2 step2.png

    2

    Search «path» in the settings menu.

    Advertisement

  3. Image titled Change the Path Environment Variable Method2 step3.png

    3

    Select Edit the System Environment Details. This option should be below Show Full Path in Title Bar and above Edit the Environment Details for your Account. A menu titled «System Properties» should pop up.

  4. Image titled Change the Path Environment Variable Method2 Step4.png

    4

    Click Environment Variables. This should be on the right-hand side of the menu below the Startup and Recovery section.

  5. Image titled Change the Path Environment Variable Method2 Step5.png

    5

    Select Path. You should not have to scroll down to find this option. It is in between two options titled OS and PATHEXT.

  6. Image titled Change the Path Environment Variable Method2 Step6.png

    6

    Click Edit, and proceed to edit the PATH environment variable.

    Warning! Unless you want to potentially destroy your PC’s system, DO NOT edit this variable unless you know what you’re doing.

  7. 7

    Select OK once you’re done editing. This will save any changes you may have made.

  8. Advertisement

  1. Image titled Windows my computer desktop screenshot.png

    1

    Create a shortcut to «My Computer». Click on «Start», mouse over «My Computer», right-click on it, and select «Show on Desktop».

  2. Image titled Windows my computer properties.png

    2

    Right-click on the shortcut and select Properties. A window will open.

  3. Image titled Windows properties environment variables.png

    3

    Switch to the Advanced tab. In that tab, click on Environment Variables. Another window will open.

  4. Image titled Windows edit path environment variable v2.png

    4

    Scroll down until you see «Path». Select it and click on Edit. A third window will open.

  5. Image titled Windows append to path environment variable.png

    5

    Edit the PATH environment variable. Unless you really know what you’re doing, don’t remove what’s already there, only append to it. For example, you could add another directory by appending: ;C:\path\to\directory, with «\path\to\directory» being the actual path to the directory.

  6. Image titled Windows environment variable editing press ok.png

    6

    Click on OK. When the window closes, there should be a short delay because the environment variable is being updated. After that, you can press OK to close the other two windows, too.

  7. Image titled Windows cmd echo path envvar.png

    7

    Check that the environment variable changed. Open the command line by pressing Win+R, entering cmd, and pressing Enter. Type: echo %PATH%. The output should be your updated PATH environment variable.

  8. Advertisement

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

Thanks for submitting a tip for review!

  • Changing the PATH environment variable wrongly can cause your system to stop working correctly. You should have a basic understanding of what you’re doing before changing PATH.

Advertisement

About This Article

Thanks to all authors for creating a page that has been read 57,667 times.

Is this article up to date?

by Remy Pereira on 12th September 2016

In older windows systems you had to navigate to Advanced System Settings in Control Panel to view, edit or add environmental variables.

  • Windows XP — Right-click My Computer, and then click Properties → Advanced → Environment variables → Choose New, Edit or Delete.
  • Windows 7 — Click on Start → Computer → Properties → Advanced System Settings → Environment variables → Choose New, Edit or Delete.

In Windows 8 and 10, you can navigate to Advanced System Settings in a similar way.

  • Windows 8 — Right click on bottom left corner to get Power User Task Menu → Select System → Advanced System Settings → Environment variables → Choose New, Edit or Delete.
  • Windows 10 — Right click on Start Menu to get Power User Task Menu → Select System → Advanced System Settings → Environment variables → Choose New, Edit or Delete. Power user task menu

However, in Windows 10 you can directly get to the Environment Variables window using Search the web and Windows box next to the Start menu. Type environment variables in Windows Search box which gives you two options in search results:

  • Edit the system environment variables
  • Edit environment variables for your account.

Choose either option and you can add, edit or delete environment variables like PATH.

Edit Environment variablesSystem Advanced OptionsEnvironment variables

Set environment variables from command prompt

You can set environment variables from Windows Command Prompt using the set or setx command. The set command only sets the environment variable for the current session. The setx command sets it permanently, but not for the current session. If you want to set it for current as well as future sessions, use both setx and set.

For example, you can set the PATH environment variable permanently (current and future sessions) as below:

C:\>setx PATH "C:\myfolder;%PATH%"

SUCCESS: Specified value was saved.

C:\>set PATH=C:\myfolder;%PATH%	

To view the current path, run:

C:\>echo %PATH%

Note:

  1. By default setx sets the variable in the local environment (Under HKEY_Current_User Registry key). If you want to set the system variable (Under HKEY_LOCAL_MACHINE registry key), use the flag /m. Start the command prompt as administrator on Windows 10, right click on Start menu and select Command Prompt(Admin).
    C:\>setx /m PATH "C:\myfolder;%PATH%"
    
    SUCCESS: Specified value was saved.
    
    
  2. The maximum value allowed for a enviroment variable is 1024 characters. So if your variable is long and you try to append to it with setx, you may get a truncated result.
    C:\>setx PATH "C:\myfolder;%PATH%"
    
    WARNING: The data being saved is truncated to 1024 characters.
    
    SUCCESS: Specified value was saved.
    

Set environment variable by Registry edit

If your PATH variable is too long, then the best method would be to edit the registry.

For user environment variables, change the key HKEY_CURRENT_USER\Environment. For System Environment variables change

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

Add, Edit or Delete the environment variable you want to change, then reboot to activate the changes.

This post shows students and new users steps to add or edit Windows PATH environment variables in Windows 11. Most programs will default add their custom shortcuts to Windows PATH environment variables.

Some programs will not automatically add to the System Path variables but let users edit or add to the path so that the program can function correctly.

The System PATH variable is one of the most used variables in Windows. It allows users to run any executables located inside the paths without giving the full path to the executables or directories to locate.

Users must search for and locate each executable without environment variables or provide full paths and directories of important program files. Environment variables create shortcuts to executables within those paths specified.

Below is how one can add or edit Windows PATH environment variables so they can run executables from their custom directories.

How to set path and environment variables in Windows 11

As mentioned, PATH and environment variables create shortcuts to executables and directories. It allows custom programs to be launched and used efficiently in Windows.

Administrator privileges are required to modify the path and environment variables. Below is how to add or edit Windows PATH and environment variables in Windows 11.

First, go to Windows Settings app. To get to the Settings app, you can use the Windows key + I shortcut or click on Start ==> Settings, as shown in the image below:

windows 11 start settings

Alternatively, you can use the search box on the taskbar and search for Settings. Then select to open it.

Windows Settings pane should look similar to the image below. In Windows Settings, click System, and select the About tile on the right pane of your screen shown in the image below.

windows 11 about

On the About screen, click the Advanced system settings link, as highlighted below.

windows 11 advanced system settings

In the System Properties window, click the Advanced tab, then click the Environment Variables button near the bottom of that tab.

You’ll typically want to add to the System variables so everyone on the System can use it. If you use the User variable, only a user who adds it may use it.

Highlight the Path variable in the System variables section and click the Edit button.

Next, add or modify the path lines with the paths you want the computer to access. Each directory path is separated with a semicolon, as shown below.

You can click the New button to add new paths or edit to modify the existing path. Delete will delete a path.

If you know the path, simply type it in or copy and paste it. You can also click Browse and navigate to the desired path you want to include in the System path variables.

Each directory path is separated with a semicolon, as shown below.

C:\Program Files;C:\Winnt;C:\Winnt\System32

That should do it.

Conclusion:

This post showed you how to add or edit PATH environment variables in Windows 11. Please use the comment form below if you find any errors above or have something to add.

  • How to enter safe mode windows 10
  • How to enter bios from windows
  • How to delete certificate windows 10
  • How to enable windows updates
  • How to delete account in windows