How to change path in windows

A simple guide to adding a directory to the Windows 10/11 path variable 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...


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:pathtodirectory, with «pathtodirectory» 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 34,889 times.

Is this article up to date?

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 window, scroll to the bottom and click the About option.
  4. In the System > About window, click the Advanced system settings link at the bottom of the Device specifications section.
  5. In the System Properties window, click the Advanced tab, then click the Environment Variables button near the bottom of that 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:WinntSystem32

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:WinntSystem32

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:WinntSystem32

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:WinntSystem32

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:WinntSystem32

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%System32Wbem

Note

Keep in mind 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.

Содержание

  1. How to set the path and environment variables in Windows
  2. Setting the path and variables in Windows 10
  3. Setting the path and variables in Windows 8
  4. Setting the path and variables in Windows Vista and Windows 7
  5. Setting the path and variables in Windows 2000 and Windows XP
  6. What is the default Windows %PATH%?
  7. Setting path in the MS-DOS and Windows command line
  8. Set PATH and other environment variables in Windows 10
  9. Set environment variables from command prompt
  10. Set environment variable by Registry edit
  11. Set path from command line
  12. How to set path from command line?
  13. Add directory to system path environment variable:
  14. Default option is not allowed more than ‘2’ time(s)
  15. How do I set system environment variables in Windows 10? [duplicate]
  16. 9 Answers 9
  17. Update: After seeing lots of comments about setting environment variables without admin in Windows 10, I think I have found a way. I was not admin and could use PowerShell.
  18. PowerShell method
  19. Old method (no longer available in newer Windows 10 updates, use PowerShell or see other answers)
  20. Adding a directory to the PATH environment variable in Windows
  21. 20 Answers 20
  22. Option 1
  23. Option 2
  24. Safer SETX
  25. Warnings
  26. Usage instructions
  27. Append to User PATH
  28. Append to System PATH
  29. Alternatives
  30. Example

How to set the path and environment variables in Windows

Setting the path and environment variables differs depending on the version of the Windows operating system you have on your computer. Choose a link below for your version of Windows.

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

Setting the path and variables in Windows 10

win10 envirvariables

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 variable value.

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

Setting the path and variables in Windows 8

winpath

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 variable value.

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

Setting the path and variables in Windows Vista and Windows 7

winpath

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 Variable value.

To view and set the path in 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.

winpath

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 Variable value.

To view and set the path in 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.

Keep in mind 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 in the Windows command line, use the path command.

Источник

Set PATH and other environment variables in Windows 10

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

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

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:

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

howto 11302 howto 11303 howto 11304

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:

To view the current path, run:

Set environment variable by Registry edit

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

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

Источник

Set path from command line

Users can run an executable from windows command prompt either by giving the absolute path of the file or just by the executable file name. In the latter case, Windows searches for the executable in a list of folders which is configured in environment variables. These environment variables are as below.

1. System path
2. User path

The values of these variables can be checked in system properties( Run sysdm.cpl from Run or computer properties). Initially user specific path environment variable will be empty. Users can add paths of the directories having executables to this variable. Administrators can modify the system path environment variable also.

How to set path from command line?

In Vista, Windows 7 and Windows 8 we can set path from command line using ‘setx’ command.

For example, to add c:dir1dir2 to the path variable, we can run the below command.

Alternative way is to use Windows resource kit tools ‘pathman.exe‘. Using this command we can even remove a directory from path variable. See download windows resource kit tools. This works for Windows 7 also.

Add directory to system path environment variable:

Open administrator command prompt
Run the below command

Remove path from system path environment variable:
Run the below command from elevated command prompt

Setting user path environment variable

For user environment varlables, admin privileges are not required. We can run the below command to add a directory to user path environment variable.

To remove a directory from user path, you can run the below command.

Default option is not allowed more than ‘2’ time(s)

You get this error if you have not enclosed ‘path’ in double quotes. See the below example for setting the path of firefox.

Now if you move %path% to be in the double quotes

Could a context entry be created for folders, perhaps an extended one… to add to path?

what about a multi-verb option, like copy as path?

Johny Why
Answer: Try add the parameter /M

Hi, is there a way I can add an extra variable instead on deleting the currently one and put a new Variable on the Path.

Nuno, pathman described above does exactly that. You can download the resource tools kit and get it.

setx path “%path%;C:yourFolder”

To set path for java & javac, can I add the paths to PATH or do I need to create the environment variable JAVA_HOME. I don’t have this defined, but windows does not seem to be able to find java binaries on my system.

You can directly add the folder to PATH. No need to define JAVA_HOME. However, adding JAVA_HOME separately avoids cluttering and helps to easily understand what is added.

hello, can someone plz explain this result? After setting path, it did not change. This was run from an Administrator command-line:

C:Windowssystem32>setx path “C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:ProgramDatachocolateybin;D:Program Files (x86)Microsoft VS Codebin”

SUCCESS: Specified value was saved.

C:Windowssystem32>path
PATH=C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:ProgramDatachocolateybin;D:Program Files (x86)Microsoft VS Codebin;D:Program Files (x86)metapad36;D:Program Files (x86)metapad36″ /M

Why won’t this work?

SET EPO = D:Program Files (x86)McAfeeePolicy Orchestrator
PATH = %PATH%;%EPO%jrebin;%EPO%apache2bin

In windows 10 set path %path%; not working. it’s work like :
setx “%path%;C:Program FilesCodeBlocksMinGWbin”

By unfortunately I deleted my system default path. How could I able to find my system path?

Unfortunately I deleted several files with unremembered path names. This article was useful

The following used to work for me when I am in MSDOS environment. Lately I get error messages such as INCLUDE not found. Why is this so?

Used to work
SET PLL =c:CL5PLL
SET PLT =c:CL5PLL
SET INCLUDE =c:CL5INCLUDE
SET PRG =c:IMSPRG
SET LIB =c:CL5LIB
SET OBJ =c:CL5OBJ
PATH =c:IMSEXE;CL5BIN;CL5NG;CL5PLL

pathman is one of many tools of the Windows Server 2003 Resource Kit Tools

Note: The Windows Server 2003 Resource Kit Tools are not supported on 64-bit platforms.

Huh.
When I did that on Windows 10 v1903, using setx, it replaced the USER scope paths with the SYSTEM scope paths.
Now I’m not sure what was in the old user path.
So, uh… Be careful out there.
And if anyone has a solution how to avoid that, please let me know
Thanks

how to del all my path and set new path.my sql iam not getting connected to XAMPP.

Thank you. Just what I needed.

pathman is one of many tools of the Windows Server 2003 Resource Kit Tools

Note: The Windows Server 2003 Resource Kit Tools are not supported on 64-bit platforms….

Источник

How do I set system environment variables in Windows 10? [duplicate]

How do I set a system environment variable in Windows 10 (without using the registry editor)?

awhYw

9 Answers 9

PowerShell method

There are different ways to work with environment variables and certain quirks with them in PowerShell so consult the link for details.

Old method (no longer available in newer Windows 10 updates, use PowerShell or see other answers)

Go into Settings and click on System.

VS4fb

Then on the left side click About and select System info at the bottom.

Y2sFF

In the new Control Panel window that opens, click Advanced system settings on the left.

bd5eF

Now in the new window that comes up, select Environment Variables. at the bottom.

af0hc

Still the same as ever: It’s in the old-style control panel’s “System” thingy. You can reach it with Win Break or by right-clicking the Start button.

From there, select “Advanced system settings” → “Environment Variables”.

Or you can do it the hard way and find some other entry point to the old-style control panel, like the Network and Sharing Center or the Desktop folder(!).

I typed «envir» in the «Search the web and Windows» box and selected «Edit environment variables for your account» under the «Best Match»

HQPYL

If by «system environment variables» you refer specifically to system-wide environment variables, then other answers have already covered this. However, if you want to edit both system-wide and user-specific environment variables then most (if not all) of these answers are inapplicable in general case.

If you attempt do that from a regular user account, then trying to access “Advanced system settings” will trigger an UAC prompt asking you for administrator password. If you enter the password, “Advanced system settings” will successfully open, but any user-specific changes you make there will apply to the corresponding administrator’s account (!), not to your original user’s account.

In order to solve this problem (i.e. in order to give regular users the opportunity to edit their own environment variables) Windows provides another way to access the “Environment Variables” dialog.

Open Control Panel. Open User Accounts applet. On the left-hand side of that applet you will see a link that says Change my environment variables. Click that link, and it will take you to the same “Environment Variables” dialog for your user’s environment variables.

0PuBj

If your user has administrator rights, you will be able to edit both sections of that dialog: user-specific environment variables (upper section) and system-wide environment variables (lower section). If you don’t have administrator rights, you will only be able to edit the upper section: your own user-specific environment variables.

This is the proper way to edit environment variables in all post-UAC versions of Windows, not what is suggested in the majority of the answers above.

Unfortunately, Windows 10 November update (version 1511) destroyed this functionality. The Change my environment variables link no longer works. It is there, but it is dead. So for the post-November version of Windows 10 the correct answer is: it is generally impossible to edit user-specific environment variables in version 1511 of Windows 10 from regular user accounts. Microsoft has destroyed Windows 10 with this update and Windows 10 is now unusable. It will remain the case until they fix these ridiculous bugs in 1511 version of the OS.

An alternative workaround is to use PowerShell features as described here https://technet.microsoft.com/en-us/library/ff730964.aspx

Windows 10 Anniversary Update (version 1607) released August 2, 2016 finally fixed this bug.

Источник

Adding a directory to the PATH environment variable in Windows

I am trying to add C:xamppphp to my system PATH environment variable in Windows.

I have already added it using the Environment Variables dialog box.

But when I type into my console:

it doesn’t show the new C:xamppphp directory:

I have two questions:

RIZKi

20 Answers 20

Option 1

After you change PATH with the GUI, close and re-open the console window.

Option 2

This option only affects your current shell session, not the whole system. Execute this command in the command window you have open:

WARNING: This solution may be destructive to your PATH, and the stability of your system. As a side effect, it will merge your user and system PATH, and truncate PATH to 1024 characters. The effect of this command is irreversible. Make a backup of PATH first. See the comments for more information.

Don’t blindly copy-and-paste this. Use with caution.

You can permanently add a path to PATH with the setx command:

You should run this command from an elevated command prompt.

If you only want to change it for the current session, use set.

PK4P1

NpQ3d

This only modifies the registry. An existing process won’t use these values. A new process will do so if it is started after this change and doesn’t inherit the old environment from its parent.

You didn’t specify how you started the console session. The best way to ensure this is to exit the command shell and run it again. It should then inherit the updated PATH environment variable.

RIZKi

Cii6b

You don’t need any set or setx command. Simply open the terminal and type:

This shows the current value of PATH variable. Now you want to add directory to it? Simply type:

If for any reason you want to clear the PATH variable (no paths at all or delete all paths in it), type:

Update

Like Danial Wilson noted in comment below, it sets the path only in the current session. To set the path permanently, use setx but be aware, although that sets the path permanently, but not in the current session, so you have to start a new command line to see the changes. More information is here.

To check if an environmental variable exist or see its value, use the ECHO command:

RIZKi

I would use PowerShell instead!

To add a directory to PATH using PowerShell, do the following:

To set the variable for all users, machine-wide, the last line should be like:

In a PowerShell script, you might want to check for the presence of your C:xamppphp before adding to PATH (in case it has been previously added). You can wrap it in an if conditional.

So putting it all together:

Better still, one could create a generic function. Just supply the directory you wish to add:

You could make things better by doing some polishing. For example, using Test-Path to confirm that your directory actually exists.

Safer SETX

Warnings

The ss64 SETX page has some very good examples. Importantly it points to where the registry keys are for SETX vs SETX /M

Usage instructions

Append to User PATH

Append to System PATH

(It’s basically the same except with a different Key and the SETX /M modifier.)

Alternatives

Finally there’s potentially an improved version called SETENV recommended by the ss64 SETX page that splits out setting the user or system environment variables.

Example

Here’s a full example that works on Windows 7 to set the PATH environment variable system wide. The example detects if the software has already been added to the PATH before attempting to change the value. There are a number of minor technical differences from the examples given above:

1. Not strictly true

YFjfm

Handy if you are already in the directory you want to add to PATH:

It works with the standard Windows cmd, but not in PowerShell.

RIZKi

Yr4dJ

Aside from all the answers, if you want a nice GUI tool to edit your Windows environment variables you can use Rapid Environment Editor.

Try it! It’s safe to use and is awesome!

RIZKi

To override already included executables;

RIZKi

It does things in an intuitive way. For example:

It shows results without the need to spawn a new cmd!

RIZKi

Regarding point 2 I’m using a simple batch file that is populating PATH or other environment variables for me. Therefore, there is no pollution of environment variables by default. This batch file is accessible from everywhere so I can type:

PTYbI

Checking the above suggestions on Windows 10 LTSB, and with a glimpse on the «help» outlines (that can be viewed when typing ‘command /?’ on the cmd), brought me to the conclusion that the PATH command changes the system environment variable Path values only for the current session, but after reboot all the values reset to their default- just as they were prior to using the PATH command.

On the other hand using the SETX command with administrative privileges is way more powerful. It changes those values for good (or at least until the next time this command is used or until next time those values are manually GUI manipulated. ).

The best SETX syntax usage that worked for me:

The PATH keyword that follows the SETX defines which set of values should be changed among the System Environment Variables possible values, and the %PATH% (the word PATH surrounded by the percent sign) inside the quotation marks, tells the OS to leave the existing PATH values as they are and add the following path (the one that follows the split sign ‘;’) to the existing values.

Источник

Download PC Repair Tool to quickly find & fix Windows errors automatically

Environment Variables are responsible for storing information about the OS’s environment. Different apps and programs require different configurations and it is the job of Windows to ensure that each of them has the environment best suitable for them. Simply speaking, these Environment Variables are data storing facilities. A PATH variable is one of the most useful of the kind and helps you to run any executable found within Paths without having to give the full path to the executable. In this article, we will be discussing how you can manually add or edit existing PATH environment variables on Windows 11 or Windows 10.

An Environment variable is useful in the sense that it influences how software processes take place. The data stored in them play an important role in the process. Our tutorial will help you set up PATH variables so that you can run executables from your custom directories. These PATH variables store shortcuts, so you can create them for the programs of your choice. A prerequisite to push PATH variables through is to grant administrative privileges, so make sure you have them enabled. If you want a more detailed explanation of what System & User Environment Variables are, you can read the linked post.

How to set PATH variables manually on Windows 11/10

Without further ado, let’s see how you can add or edit a PATH Environment Variable in Windows 11/10:

  1. Click on the Search menu on the Taskbar and open the Windows Settings
  2. From the Settings panel, click on the System option from the left menu pane
  3. Go to About and further click on Advanced System Settings. This will open a dialog box named System Properties
  4. Here, click on the Advanced tab and further click on the Environment Variables button on the bottom-right
  5. This will open the Environment Variables panel. Here, variables will be divided into two categories: System and User Variables. The former is applicable for system-wide changes while the latter is used to make modifications to the environment of a particular user. Make a decision based on the purpose of creating or editing a PATH variable and select PATH from a section
  6. Follow this by clicking on the Edit button

add or edit a PATH Environment Variable in Windows

You can now modify the existing route lines with the ones you want your computer to access. This stuff may seem overwhelming to some of you and has very deep implications for some important PC processes, so you’re advised to express utmost caution.

In order to add a new route, you can click on the ‘New’ button. You can delete a Path the same way. Here, you can just paste the Path of your choice, and if you’re unsure of it, then you can use the Surf option to go about searching for it. Once you’re done, click on Ok and a new PATH variable will now exist.

Our guide here explains how you can add Environment Variables to your Windows Context Menu.

Read: How to see Names and Values of Environment Variables in Windows

How do I change Environment Variables without admin rights?

Granting administrative rights may not be as easy when the PC isn’t yours, but you can still make changes to your environment variables. Via the Control Panel, you can modify the environment variables on a user account, but not System variables. Here’s how you can do that:

  • Open the Control Panel
  • Select to view them as ‘Small icons’ and click on User Accounts
  • Here, you’ll see an option to your left named ‘Change my environment variables’
  • This will open the same Environment Variables dialog box as before, except now the System Variables aren’t accessible and you can only make changes to User variables

TIP: Rapid Environment Editor is a powerful free Environment Variables Editor for Windows.

How do I change the Path in Windows Command Prompt?

A command line on your Windows Terminal (Command Prompt) can help you add a Path to your Path environment variable. The changes that we have discussed above can be implemented via the Command Prompt as well, but again, are limited to the User’s environment only. Here’s how:

  • Search ‘CMD’ on the Taskbar search menu and select to run it as the administrator
  • Enter the command ‘Pathman /au’ and follow it by the Path to the directory you want to append.
  • Similarly, you can use a ‘Pathman/ru’ command to delete an existing Path to a directory

We hope that this post was helpful for you and that you can now take care of your Path environment variables with ease.

Shiwangi loves to dabble with and write about computers. Creating a System Restore Point first before installing new software, and being careful about any third-party offers while installing freeware is recommended.

Содержание

Введение
Для чего используется
Пример
Добавить директорию в PATH
Изучить содержимое PATH
Ошибки
Postgesql
Похожие статьи

Введение

Если Вам нужно настроить PATH в Linux — перейдите

сюда

Для чего используется

Когда Вы выполняете какую-либо команду в консоли, система ищет соответствие
между названием этой команды и программой, которую можно выполнить.

Искать по всему жёсткому диску было бы слишком долго, поэтому поиск
осуществляется только по некоторым директориям.

Список этих особых директорий хранится в системной переменной PATH.

Пример

Предположим, что возникла необходимость запускать какую-то программу, например

Firefox

, непосредственно из командной строки.

Без предварительной подготовки ввод Firefox в консоль выдаст ошибку.

C:Usersa>firefox

‘firefox’ is not recognized as an internal or external command, operable program or batch file.

Чтобы решить эту проблему нужно добавить директорию с испоняемым файлом firefox в PATH

Добавить директорию в PATH

Быстрый способ перейти к редактированию PATH — нажать клавишу Win и ввести в поиск env

Env с сайта www.andreyolegovich.ru

Пошаговый способ:

Правый клик на Этот Компьютер (This PC) → Свойства (Properties)

Мой компьютер Свойства изображение с сайта www.andreyolegovich.ru

Дополнительные параметры системы (Advanced system settings)

Control Panel - All Control Panel Items - System изображение с сайта www.andreyolegovich.ru

Дополнительно (Advanced) → Переменные среды (Environment Variables)

Environment Variables изображение с сайта www.andreyolegovich.ru

Если хотите менять для всей системы, то в окошке «Переменные среды»
(System Variables)
найдите строку PATH в блоке
«Системные переменные» (System variables)
выделите кликом и нажмите кнопку «Изменить…» (Edit…)

Если хотите менять только для своего пользователя, то делайте это в блоке
«Переменные среды пользователя %USERNAME%» (User variables for %USERNAME%)

Environment Variables изображение с сайта www.andreyolegovich.ru

Создайте новый путь (New)

Path Environment Variable изображение с сайта www.andreyolegovich.ru

Введите адрес директории в которой лежит нужная программа. В нашем случае это

C:Program Files (x86)Mozilla Firefox

Path Environment Variable изображение с сайта www.andreyolegovich.ru

Перезапустите консоль или открываем новую и пишем там firefox.

C:Usersa>firefox

Браузер должен запуститься.

Изучить содержимое PATH

В

PowerShell

достаточно выполнить

echo $Env:Path

C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;

Или

Get-ChildItem Env:Path

Name Value
—- ——
Path C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPo…

В cmd.exe посмотреть список переменных
окружения можно выполнив команду

set

без параметров.

set

Выдача содержит системные переменные и переменные пользователя
а также дополнительную информацию. Содержимое PATH выделено зелёным.

результат выдачи команды set без параметров

Ошибки

-bash: syntax error near unexpected token `(‘

Скорее всего Вы пытаетесь добавить в unix PATH адрес из Windows, c пробелами, скобками и так далее.

Например:

andrey@olegovich-10:/usr/share$ export PATH=/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath_target_1128437:$PATH

-bash: syntax error near unexpected token `(‘

Для решения этой проблемы Вам нужно экранировать пробелы и скобки. Если импортируется много путей и ввод очень длинный —
немного проще записать PATH=$PATH:/путь , если Вам подходит запись в конец.

Также нужно помнить, что все лишние пробелы сломают импорт — для проверки можно сделать весь скрипт в одну строку
в текстовом редакторе.

Также стоит помнить, что если Вы работаете в

bash под Windows
,
то переменные окружения нужно задавать через Windows.

andrey@olegovich-10:/usr/share$ export PATH=$PATH:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath_target_1128437

Postgesql

Приведу пример для использования psql из

bash под Windows

— это может пригодиться если Вы хотите временно добавить
путь к psql в PATH чтобы запустить

Postrgres

скрипт.

В моём случае

psql.exe

находится в папке C:Program FilesPostgreSQL12bin

PATH=$PATH:/mnt/c/Program Files/PostgreSQL/12/bin

Похожие статьи

Windows
Loudness Equalization
PowerShell
Посмотреть конец файла в PowerShell (аналог tail)
Создать новый файл в PowerShell (аналог touch)
Проверить контрольную сумму файла в PowerShell (аналог md5sum)
Windows Firewall
Remote Desktop Protocol
Драйверы в Windows
Режим разработчика в Windows 10
BASH в Windows 10
Telnet в Windows 10
Системная переменная PATH
Установка Windows на gpt диск
batch file
pstools
Удалённый рабочий стол
Горячие клавиши

Windows 7

  • From the desktop, right click the Computer icon.
  • Choose Properties from the context menu.
  • Click the Advanced system settings link.
  • Click Environment Variables.
  • In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable.

How do I set the path in Windows 10?

Add to the PATH on Windows 10

  1. Open the Start Search, type in “env”, and choose “Edit the system environment variables”:
  2. Click the “Environment Variables…” button.
  3. Under the “System Variables” section (the lower half), find the row with “Path” in the first column, and click edit.
  4. The “Edit environment variable” UI will appear.

How can I change the path in CMD?

To access another drive, type the drive’s letter, followed by “:”. For instance, if you wanted to change the drive from “C:” to “D:”, you should type “d:” and then press Enter on your keyboard. To change the drive and the directory at the same time, use the cd command, followed by the “/d” switch.

How do I edit the path in Windows?

Finding the Windows Path Variable

  • Open the Start Menu.
  • Right-click on Computer and click Properties.
  • Click Advanced system settings.
  • Make sure you’re on the Advanced tab.
  • Click Environment Variables.
  • Under System variables, scroll to find the Path Variable.
  • Click on Path and then click Edit.

How do I find my path in CMD?

Command Prompt

  1. Open a Command Prompt window as administrator. Windows 10: press Win⊞ + S, type cmd, then press Ctrl + Shift + Enter. Or click Start, and click All Programs.
  2. Enter the command setx JAVA_HOME -m “Path” . For “Path”, paste in your Java installation path .

What is the PATH environment variable used for?

More specifally, it is an environment variable that is used across both Windows and Unix operating systems. Wikipedia has a halfway decent definition: PATH is an environment variable on Unix-like operating systems, DOS, OS/2, and Microsoft Windows, specifying a set of directories where executable programs are located.

How do I set Java path in Windows 10?

How to set JAVA_HOME in Windows 10

  • Open Advanced System Settings. In Windows 10 press Windows key + Pause Key, This will open the System Settings window.
  • Set JAVA_HOME Environment variable. In “System Properties window” click “Environment Variables…”
  • Update System PATH.
  • Test your configuration.

Windows 10 and Windows 8

  1. In Search, search for and then select: System (Control Panel)
  2. Click the Advanced system settings link.
  3. Click Environment Variables.
  4. In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable.

How do I set ADB path in Windows?

Adding adb and Fastboot to the Windows PATH (Method 2)

  • Open Windows Explorer and right click “My PC”.
  • Select “Advanced System Settings”.
  • Select “Environment Variables”
  • Look for the variable named “Path” and double click it.
  • Click “Browse” and navigate to the folder where you extracted your adb files.

How do I open a command prompt window in a folder?

In File Explorer, press and hold the Shift key, then right click or press and hold on a folder or drive that you want to open the command prompt at that location for, and click/tap on Open Command Prompt Here option.

How do I find the path in Windows?

From the Desktop, right-click the Start button and click System.

  1. After the System screen appears, select Advanced system settings.
  2. This will open the System Properties window.
  3. Under the System variables section, scroll down and highlight the Path variable.

Where is my python path windows?

Is Python in your PATH ?

  • In the command prompt, type python and press Enter .
  • In the Windows search bar, type in python.exe , but don’t click on it in the menu.
  • A window will open up with some files and folders: this should be where Python is installed.
  • From the main Windows menu, open the Control Panel:

How do I reset the PATH variable in Windows 10?

5 Answers

  1. In Windows 10 navigate to Start > Settings > Update & Security > Recovery.
  2. Under Advanced Startup, click Restart Now.
  3. Once the computer reboots into Advanced Startup, click Troubleshoot.
  4. Click Refresh Your PC.

How do I find my system path?

  • Right-click on the Start Button.
  • Select “System” from the context menu.
  • Click “Advanced system settings”
  • Go to the “Advanced” tab.
  • Click “Environment Variables…”
  • Click variable called “Path” and click “Edit…”
  • Click “New”
  • Enter the path to the folder containing the binary you want on your PATH.

How do I find Java path in Windows?

Add Java to the Windows Path

  1. Step 1: Load the System Properties.
  2. Step 2: Find the Advanced Tab in the Properties Window. Click Environmental Variables.
  3. Step 3: Scroll down in the System variables and find the PATH variable. Select the PATH variable and click the Edit button.
  4. Step 4: Add the Java installation path to the PATH variable.

What is add to PATH?

PATH is an environment variable on Unix-like operating systems, DOS, OS/2, and Microsoft Windows, specifying a set of directories where executable programs are located. In general, each executing process or user session has its own PATH setting.

Why do we set PATH environment variable?

Environment variables are global system variables accessible by all the processes running under the Operating System (OS). Environment variables are useful to store system-wide values such as the directories to search for the executable programs ( PATH ) and the OS version.

What is path testing in software?

Path testing is an approach to testing where you ensure that every path through a program has been executed at least once. You normally use a dynamic analyzer tool or test coverage analyser to check that all of the code in a program has been executed. The starting point for path testing is a program flow graph.

What is the use of environment variables in Windows?

An environment variable is a dynamic “object” on a computer, containing an editable value, which may be used by one or more software programs in Windows. Environment variables help programs know what directory to install files in, where to store temporary files, and where to find user profile settings.

How do you check if Java_home is set correctly in Windows?

Windows

  • Check if JAVA_HOME is already set ,
  • Make sure you have installed Java already.
  • Right click on the My Computer icon on your desktop, then select Properties.
  • Click the Advanced Tab.
  • Click the Environment Variables button.
  • Under System Variable, click New.
  • Enter the variable name as JAVA_HOME.

What is the path for Java_home?

Set JAVA_HOME: Right click My Computer and select Properties. On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:Program FilesJavajdk1.6.0_02.

How do I change environment variables in Java?

For Windows:

  1. Right click on ‘My Computers’ and open ‘Properties’.
  2. In Windows Vista or Windows 7, go to “Advanced System Settings”.
  3. Go to ‘Advanced Tab’ and click on Environment Variables button.
  4. Select ‘Path’ under the list of ‘System Variables’, and press Edit and add C:Program Filesjavajdkbin after a semicolon.

How do I navigate to a folder in CMD?

To do this, open a command prompt from the keyboard by typing Win+R, or click on Start Run then type cmd in the run box and click OK. Navigate to the folder you want displayed in Windows Explorer by using the Change Directory command “cd” (with out the quotes).

How do I find a folder using command prompt?

HOW TO SEARCH FOR FILES FROM THE DOS COMMAND PROMPT

  • From the Start menu, choose All Programs→Accessories→Command Prompt.
  • Type CD and press Enter.
  • Type DIR and a space.
  • Type the name of the file you’re looking for.
  • Type another space and then /S, a space, and /P.
  • Press the Enter key.
  • Peruse the screen full of results.

How do I open a command window?

Start the Command Prompt using the Run window (all Windows versions) One of the quickest ways to launch the Command Prompt, in any modern version of Windows, is to use the Run window. A fast way to launch this window is to press the Win + R keys on your keyboard. Then, type cmd and press Enter or click/tap OK.

Where is my Java path in Windows?

Java and the Windows Command Prompt

  1. Select Start -> Computer -> System Properties -> Advanced system settings -> Environment Variables -> System variables -> PATH.
  2. Prepend C:Program FilesJavajdk1.6.0_27bin; to the beginning of the PATH variable.
  3. Click OK three times.

How do you check if Java is installed on Windows command prompt?

Checking the Java version on Windows

  • Log on to your MILS Windows Server 2008 machine as user pvadmin .
  • Open the Control Panel and click Programs and Features.
  • Search for Java .
  • Open a command prompt.
  • Enter the command java -version.

How do I know if Java is installed on Windows?

Q: How can I tell if Java Runtime Environment is installed on my Windows machine?

  1. Open the command prompt. Follow the menu path Start > Programs > Accessories > Command Prompt.
  2. Type: java -version and press Enter on your keyboard.

What is path math?

A path is a trail in which all vertices (except possibly the first and last) are distinct. A trail is a walk in which all edges are distinct. A walk of length in a graph is an alternating sequence of vertices and edges, , which begins and ends with vertices. If the graph is directed, then is an arc from to .

How do I add to my path in Windows 10?

Add to the PATH on Windows 10

  • Open the Start Search, type in “env”, and choose “Edit the system environment variables”:
  • Click the “Environment Variables…” button.
  • Under the “System Variables” section (the lower half), find the row with “Path” in the first column, and click edit.
  • The “Edit environment variable” UI will appear.

What is path stand for?

Program for Appropriate Technology in Health

How do I reset Windows environment variables?

Resetting the TEMP Environment Variable

  1. Choose Start > Settings > Control Panel.
  2. Double-click System.
  3. Click the Advanced tab, and then click Environment Variables.
  4. Under User Variables or System Variables, double-click the TEMP variable.
  5. Enter a valid directory, and then click OK.
  6. Restart the Silk Test installation by double-clicking the EXE file.

How do Environment variables work?

A running program can access the values of environment variables for configuration purposes. Shell scripts and batch files use environment variables to communicate data and preferences to child processes.

What are environment variables in Windows 10?

Use these environment variables to quickly browse Windows 10 locations on any computer. On Windows 10, environment variables are predefined names that represent the path to certain locations within the operating system, such as to a drive or a particular file or folder.

Photo in the article by “National Park Service” https://www.nps.gov/gett/learn/management/2017-year-in-review.htm

Sorry for the long answer, but a short answer on your question is impossible.

First of all you should understand how environment variables works. There are some places in the registry like HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment and HKEY_CURRENT_USEREnvironment where the environment variables will be hold. On start-up the operation system reads this registry keys. Then one windows process creates another windows process. The parent process can give to the client process any set of environment variables. If the parent process doesn’t do this, the child process inherits environment variables of the parent processes.

To be able update environment variables of a running process with respect of WM_WININICHANGE or WM_SETTINGCHANGE messages. A windows application can interpret this messages and reread the current environment variables from the registry HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment and HKEY_CURRENT_USEREnvironment. So you can in general change registry values under HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment or HKEY_CURRENT_USEREnvironment and send

SendMessage (HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Environment");

It would be much better to use SendMessageTimeout instead of SendMessage, but the idea will stay the same. The problem is that other processes must not wait for the message and do something. Most console application have no message loop and don’t do anything if you send such messages.

So it is important to understand that there is no simple way to update environment variables of all processes without restarting of the computer. You should have a clear understanding of this and reduce your question a little.

If you update the environment in registry and send SendMessage (HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Environment") then new processed created by Explorer.exe will be have new environment variables, but cmd.exe will not do this.

If you want to update environment variables of the current cmd.exe inside a batch run you can do the following: You can create a new CMD file for example t.cmd in %TEMP% directory, write in the file SET PATH=%PATH%;C:BlaBla and then use call %TEMP%t.cmd and dell %TEMP%t.cmd to update environment variables of the current cmd.exe.

To be exactly there are more places which are used to build environment variables of new created processes. This are subkeys of the key HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths and %SystemRoot%System32autoexec.nt file. One will be used for processes created by ShellExecute and ShellExecuteEx (for example Explorer.exe) and another for console applications.

Learn to customize your Windows 10 device to your liking

by Matthew Adams

Matthew is a freelancer who has produced a variety of articles on various topics related to technology. His main focus is the Windows OS and all the things… read more


Updated on September 12, 2022

Reviewed by
Vlad Turiceanu

Vlad Turiceanu

Passionate about technology, Windows, and everything that has a power button, he spent most of his time developing new skills and learning more about the tech world. Coming… read more

  • The Windows 10 path variable edit is a very useful feature if you use Command Prompt very often.
  • Using the advanced system settings is one way of how to change the path in Windows 10.
  • The process is as simple as editing the variables in the Environment Variables.
  • There you can also set the path in Windows 10 in the System variables box.

XINSTALL BY CLICKING THE DOWNLOAD FILE

To fix various PC problems, we recommend DriverFix:
This software will keep your drivers up and running, thus keeping you safe from common computer errors and hardware failure. Check all your drivers now in 3 easy steps:

  1. Download DriverFix (verified download file).
  2. Click Start Scan to find all problematic drivers.
  3. Click Update Drivers to get new versions and avoid system malfunctionings.
  • DriverFix has been downloaded by 0 readers this month.

The Command Prompt tool is the last remnant of DOS (a former command-based operating system) preserved in Windows. You can open software and run handy tools, such as the System File Checker, with it.

For example, you can run SFC by entering sfc /scannow without specifying any path. To open third-party software in Windows 10, you would usually need to input a full directory in the Command Prompt.

What is the path environment variable in Windows?

The Edit environment variable window enables you to add new paths to third-party software so that you can open the programs without entering their full directories in the Command Prompt.

The path environment variable tells your system where it can find the SFC, but not the software. Moreover, this variable could be a handy setting for those who often make use of the Command Prompt.

Microsoft even replaced the Edit System Variable dialog in earlier Windows platforms with a new Edit environment variable path window in Windows 10.

This system path variable can be edited by users and we will show you how to do this in the guide below.

How can I edit the path on Windows 10?

The easiest way to edit the path variable in Windows 10 is through the View advanced system setting. There you can add, edit, or delete a path variable.

After that, you can set the path that’s of interest to you and modify it in any way you want.

1. Press the Windows key on your keyboard or the Start button on your taskbar to open the search box.

2. In the Windows search box, type advanced system settings and click on the result.

3. When the System properties window opens, select View advanced system settings.

view advanced system settings windows

4. Press the Environment Variables button to open the window shown below.

edit path in windows 10 variables

5. You need to select the Path in the System variables box. Selecting the Path and pressing the Edit button opens the window shown directly below.

edit path variable windows 10

6. The Edit environment variable window above includes the following path: C:Windowssystem32

This is where the System File Checker tool is. To add your own path, press the New button.

create new variable

7. Enter C: in the empty space and press the Browse button to select a folder (If you don’t enter something in the space for the new path, your selected folder directory replaces the path listed above it).

8. Select a folder that includes third-party software in the Browse for Folder window. For example, we selected a folder that includes Firefox.

9. Press the OK button on the Browse for Folder window to confirm the selection (The Edit environment variable window will include your selected path as in the snapshot below).

edit mozilla variable windows 10

10. Click the OK button on the Edit environment variable window to close it.

11. Press the OK buttons on the Environment Variables and System Properties windows to close them.

12. Re-open the Windows search box and type cmd in it, then right-click on the result and select Run as Administrator, to open the app as below.

open cmd window

13. Now you can open the software path you added to the Edit environment variable window by entering its executable.

For example, if you added Firefox’s path to it you can open that browser by entering Firefox in the Command Prompt.

Read more about this topic

  • How to save text from the Command Prompt in Windows 10
  • How to Fix Opera Browser if It Fails to Install or Download
  • 10 Ways to Fix File Explorer Problems in Windows 10/11
  • 16 Ways To Stop Firefox From Using Too Much Memory in 2022
  • Windows Explorer stops when copying files? Fix it like a pro

A program’s executable doesn’t always match the exact software title. For example, we found that Opera’s executable was Launcher. As such, check the software’s executable title in File Explorer and then enter that in the Command Prompt.

No longer do you need to enter C:foldersub-foldersub-folder software title to open a program. This certainly comes in handy if you’re not entirely sure what the software’s path is.

This is a fairly simple process and after following the steps above setting, editing, or changing the path environment variable in Windows 10 should be more or less a formality.

If you have any other questions about the process, feel free to leave them in the comments section below.

newsletter icon

Newsletter

Понравилась статья? Поделить с друзьями:
  • How to change mtu in windows
  • Hotline miami 2 windows xp скачать
  • How to change mouse cursor windows 10
  • Hotkeyscmds в автозагрузке что это за процесс windows 7
  • How to change microsoft account on windows 10