Edit the PATH environment variable in Windows without pain

Editing the PATH environment variable in Windows is an unpleasant experience. First, it takes several steps to get to the interface. Second, the interface is impossible:

Editing a system variable in Windows 7

Something you can do to make the task easier is copy the whole field, edit it in a text editor and paste it back. But there are better ways.

Here I suggest four alternative tools for editing the PATH and other environment variables from a proper interface. Two are command-line tools and the other two have a graphical interface. All are available for free. I list them in order of personal preference.

pathed

I like pathed most because it is the simplest. It is a command-line tool, part of the GTools collection. Its usage is straightforward:

C:\Users\demetris>pathed --help
PATHED - Version 3.2
Freeware written by Gerson Kurz (http://p-nand-q.com)

USAGE: PATHED.EXE [OPTIONS]
OPTIONS:
      /MACHINE: print machine PATH
         /USER: print user PATH
          /ADD: add variable at the head
       /APPEND: add variable at the tail
       /REMOVE: remove path / index
         /SLIM: strip duplicate vars
          /ENV: environment variable, defaults to PATH

For example, say that you have your Sysinternal tools in C:\Bin\Sysinternals and you want to add them to the PATH. Simply do:

pathed /append C:\Bin\Sysinternals /machine

If you want to add them to the user PATH system instead, then do:

pathed /append C:\Bin\Sysinternals /user

If you want to know what’s in the PATH before you start editing, pathed does that equally well. Simply use pathed. Typing pathed without any arguments gives you a clean readable list of the machine PATH:

C:\Users\demetris>pathed
PATHED - Version 3.2
Freeware written by Gerson Kurz (http://p-nand-q.com)

00 C:\Windows
01 C:\Windows\system32
02 C:\Windows\System32\Wbem
03 C:\Windows\System32\WindowsPowerShell\v1.0\
04 C:\Program Files\Common Files\Microsoft Shared\Windows Live
05 C:\Program Files\SlikSvn\bin\
06 C:\Program Files\TortoiseHg\
07 C:\Program Files\TortoiseSVN\bin
08 C:\Program Files\Windows Live\Shared
09 C:\Bin
10 C:\Bin\GTools

NOTE. GTools does not add its own directory to the PATH automatically. I find it makes sense to add it yourself, so that you can use the individual tools quickly from everywhere.

GTools and pathed homepage · License: New BSD License · Source code

PathEditor

If you prefer something with a graphical interface, then PathEditor is an equally simple and straightforward editor and viewer:

PathEditor, a simple tool for Windows

PathEditor also offers an advanced mode, where you can do more than just editing the PATH variable. To learn about the advanced mode, look at the program’s manual.

Path Editor homepage · PathEditor manual · License: Simplified BSD License · Accepts donations

Rapid Environment Editor

For something that can do more than either pathed or PathEditor, you can try the Rapid Environment Editor, a feature-rich viewer and editor for all environnent variables:

Rapid Environment Editor, a tool for environment editing variables in Windows

I have not used or explored Rapid Environment Editor properly, because it is more than I need. So, I can’t say how good it is in practice. But it seems to be a carefully made application, and the fact that it has been translated in 13 languages, all by volunteers, suggests that it works well and that it is appreciated by lots of people.

Rapid Environment Editor homepage · License: Freeware · Accepts donations

Other

For Windows XP and Windows Server 2003, another alternative is pathman.exe, a command-line path manager included in the Windows Server 2003 Resource Kit Tools that lets you add and remove directories to and from the user PATH and the system PATH. While not as helpful as pathed, the other CLI tool in this list, pathman is certainly better than the default edit box.

Please note that Windows Vista, Windows Server 2008 and Windows 7 are not officially supported by the 2003 Resource Kit Tools. For these versions of Windows select one of the other three path editors.

Links

To recap:

Thank you for reading!

Comments (1)

  1. Daniel Williams says:

    Thank you – REE is incredibly helpful!

Write a comment

Your email address will not be published. Required fields are marked *