Posted by: Ed Tittel
editing the Windows path environment variable, editing Windows environment variables, Redmond Labs .Net, Redmond Path, Windows 7
As I work with Windows from day to day, I often find myself looking at the way things work inside that OS and wondering why some things can’t be improved. Recently, I’ve tech-edited a book on the Python-based Django Web development environment and have been digging into the Windows Preinstallation Environment and the Windows Automated Installation Kit (aka WAIK or Windows AIK). Both of these projects have required me to edit the Windows path variable, which defines an ordered list of directory specifications that Windows searches when you tell it to find something. In short, this is the capability that lets you enter cmd.exe into the Search box in Vista or Windows 7, and that resolves that request into C:\Windows\System32\cmd.exe which is the actual complete specification for that file.
Alas, editing the path variable in the default Windows environment remains a bit irksome. You can do it at the command line, using syntax like
path = %path%;C:\Example to add a directory spec at the end of the path, or by reassigning an entirely new path value when you want to change the search order. Or, you can click the Windows logo and Break keys at the same time to launch the System window, and then do the following:
- Click on Advanced System Settings in the task area at the upper left of the System window to launch System Properties.
- Click the Environment Variables button at the bottom right of the System Properties window to open the Environment Variables window.
- Scroll down in either the User or System variables panes inside the Environment Variables window until you see the path entry, then click Edit.
- This opens an Edit System Variable or Edit User Variable button, where you can inspect and edit the value for that variable in the Variable value: textbox therein, as shown here:
The problem, of course, is that it’s not unusual for a path variable to get pretty large in Windows (mine is currently 257 characters long, and I’ve seen longer) but the textbox area for display accommodates only around 40 characters. That makes scrolling back and forth inside that box something of a pain. I won’t bother to complain about the vagaries of editing the value at the command line, because the best way to do that already does so eloquently: run cmd.exe, type
set at the command line, use multiple inline editing commands to grab the path variable value, paste it into a text editor for manipulation, then reverse the process to reassign its value.
Fortunately, there is a much better way to do this. Freeware called Redmond Path from Redmond Lab .Net is available to improve and simplify editing path variable values. A single screenshot tells the whole story here.
Click the plus sign to create a new value, or highlight and click the red X to remove an existing value. Highlight a value, then use the up and down arrows to change its place in the search order. All values appear in order as individual entries in a vertical list and can be managed as such.
Simple. Easy. Effective. Free. Why doesn’t Microsoft do it that way?