In which places is the Windows %PATH% defined? [duplicate]

Posted on


Possible Duplicate:
What are PATH and other environment variables, and how can I set or use them?

I ran a third-party install script which added its folders to the %PATH% variable in the Windows shell.

I want to get rid of it, but I can’t find the place where they are defined. My current %PATH% variable seems to be a concatenation of:

  • PATH for current user
  • PATH for the entire system
  • something else?


1. This applies to Windows 7 (and I think to Vista as well):

  • Start > Right-click on Computer > Properties.
  • Advanced System Settings link (on left).
  • Environment Variables button.
  • You will find a Path variable under the System variables section.
    • Select it and click Edit button to edit it.
    • You may also find a Path variable under the User variables section. You can edit it also.
  • When done, click OK three times.

Tip: The Edit variable window is not very user-friendly. Copy the contents to Notepad for easier editing, and then copy the edited version back.

2. Some systems may contain a PATH variable in the Volatile Environment. This variable is normally created on a computer connected to domains and usually cleared off at log out. However, you may want to check whether a PATH variable persists in the Volatile Environment:

  • Start > type in regedit.
  • Run the regedit.exe program that is found in the search.
  • Navigate to HKEY_CURRENT_USERVolative Environment in Registry Editor’s left pane.
  • If there is any entry with the name PATH on the right pane, ensure that the stored paths are not necessary^, then right-click the entry and click Delete.
  • Click Yes to the message.
  • Restart your computer for changes to take effect.

^ If any of the stored paths is necessary:

  • Copy it to a Path entry in HKEY_CURRENT_USEREnvironment.
    • You will have to copy the text manually. There is no drag-and-drop copying in Registry Editor.
    • Double-click on the original entry to open the Edit String dialog, and then copy the necessary text.
  • If there is no Path entry in HKEY_CURRENT_USEREnvironment:
    • Right-click an empty space in right page and choosing New > String Value.
    • Type the name Path.
    • Press Enter twice to save the name and open the Edit String dialog.
    • Paste in the copied text.
    • Click OK.

Source on Volatile Environment (See Using Volatile Environment PATH towards the end.)

You can use the Setx command at the command prompt to edit environment variables persistently, as it affects the values stored
in the registry. Setx by default works on the user variables, and SetX with the -m option edits machine-wide environment
variables (and consequently must be run from a command prompt with administrative privileges). The PATH environment variable is
indeed a composite of current user and machine variables as stored in the registry.