Thursday, December 1, 2016

In which places is the Windows %PATH% defined?






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?


Answer



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.


screenshot


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_USER\Volative 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_USER\Environment.

    • 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_USER\Environment:

    • 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.)


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...