Edit Environment Variables in the Registry

I’m annoyed with the state of environment variables, more specifically the PATH variable. It used to be not entirely intuitive but relatively easy to edit. You’d right-click My Computer > Properties > Advanced > Environment Variables and be home free.

Recently, I needed to add a value to my PATH variable. In Windows 8.1, finding the advanced system properties is a little different, but I made it there without too much trouble. So, I selected the PATH variable, clicked the edit button, and was presented with a dialog box. It looked good, but I couldn’t type anything!

I believe I wasn’t able to type because my existing value exceeded the the character limit of 1024. I’m sure this limit has been there all along, but it was super annoying to deal with. I was able to get around the problem by using PowerShell. This worked fine for adding a new path to the environment variable, but I don’t think it would be so great for editing to remove an unneeded path or correct a mistake. But whatever, it worked, and I thought I was in the clear until today when I found that my added path had inexplicably been removed! Gah!

I headed back to Google for a better solution, and I think I found a winner. You can edit the values in the registry, which gives me everything I’m looking for. I can copy the entire existing value into a text editor, make whatever changes, and then copy it back into the registry and save. Oh, and then you have to reboot. (Ugh.) This all seems WAY harder than it should be, but it does work, and I found it to be less annoying than the alternatives I could find.

Here are the registry keys:

  • User – [HKEY_CURRENT_USER\Environment]
  • System – [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]

 

Advertisements

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s