Quickly Edit Environment Variables in Windows 8

Environment variables in an operating system are a set of dynamic named values that can affect the way running processes will behave on a computer. They include information about the system environment and the currently logged in user.
Note: Environment variables are not limited to Windows operating systems, but for the purpose of this article I will relate to the ones found in the Windows OS.

About Environment Variables

Environment variables are sometimes used by applications, system services, or other processes to determine various configuration settings about the way the OS is configured, where files are stored in the user’s profile, how many CPU and what CPU architecture the system has, and much, much more.
In the Windows OS there are several types of environment variables. The most widely-known ones are user variables and system variables. However, it may be useful to know that beyond these two there are also process variables and volatile variables.
The way these variables are used is related to their type. For example, user environment variables are accessible to all apps which run in the context of the logged on user, while system environment variables apply to all the users and all the processes that log on and run on that computer. Process variables are used specifically only by specific processes. For example: Software that sets it’s own variables, such as the installation directory, the place where the data is stored, and so on. Volatile variables are variables that only exist and are only true for the current logon session.
So how do we view, and if needed, edit these variables?

How to Edit Environment Variables in Windows 8

There are several methods of editing environment variables in Windows 8, and I’ve listed three of the most common methods below.
Note: Modifying the system or user variables without proper knowledge may lead to a system or application failure. Take care and make sure you have a working backup before experimenting.

1. Use the System Applet

The “regular” method for viewing environment variables would be to use the System applet in Control Panel, or by right-clicking “This PC” in Windows Explorer, or by using the Windows Logo + Break keyboard combo.

edit environment variables in Windows 8
Accessing environment variables in Windows 8. (Image: Daniel Petri)

Note: In older Windows versions, “This PC” used to be called “My Computer”. Same same.
While in there, you need to click on the “Advanced system settings” link on the left pane, and then click on the “Environment Variables” button. Note that the applet separates the user variables from the system variables.

Per user and system wide variables in Windows 8
The difference between per user and system wide variables in Windows 8. (Image: Daniel Petri)

To quickly get to the same applet you can type the following command in a Command Prompt window that was started with elevated credentials (“Run as Administrator”):

​rundll32.exe sysdm.cpl,EditEnvironmentVariables

You can also create a shortcut for it on the Desktop, and if needed, pin it to the taskbar or even the Start page.

2. Use the SET command

This one has been around since the time of MS-DOS, and still works for viewing the user and system variables.
Open the command prompt window and type the following command:


Press Enter.

Using the set command to set environment variables in Windows 8.
Using the set command to set environment variables in Windows 8. (Image: Daniel Petri)

If you want to view the value of a specific system or user variable, you can use the “echo” command. For example:

​echo %computername%


​echo %username%


​echo %appdata%

and so on.

3. Use the Registry

Many of these variables are stored inside the Windows OS Registry.
Warning! Edit the registry with care, as you do so at your own risk. Always back up the registry before making changes. If you make mistakes or introduce errors, you may not be able to boot the Windows PC with the edited registry. If you don’t feel comfortable editing the registry yourself, find an experienced Windows system administrator to help you complete this task safely.
Log in to the computer using administrative credentials.
Press Win+R keys on your keyboard and type “regedit.exe” (no quotes) into the “Run” dialog box. Click Enter. If you are prompted by UAC, click Yes.
In the Registry editor window:
To see user variables, go to the following key:

Using the registry to edit Windows 8 environment variables
Using the registry to edit Windows 8 environment variables. (Image: Daniel Petri)

To see system variables, go to the following key:

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment

Using the registry to edit Windows 8 environment variables via the environment key. (Image: Daniel Petri)

You can pull these values from the Registry and modify them by using multiple programming methods and tools.

Related Article: