What are environment variables in Windows?

Have you ever wondered about environment variables? Maybe some IT admin or computer geek was mentioning them. Did some programs start malfunctioning and returning errors referring to environment variables? Did you just have an exam, and the only item you didn’t know how to fill in was: "environment variables are ____________."? No matter your reasons for wanting to learn more about them, you arrived at the right place. In this article, we show you what you need to know about environment variables, how they work, and why they are essential for Windows’ wellbeing:

What are environment variables in Windows?

So what is an environment variable? Environment variables are, in short, variables that describe the environment in which apps and programs run. All kinds of programs use environment variables to answer questions like: What’s the name of the computer where I’m installed? What is the name of the user account that is running me? What is my current working directory? Where is Windows installed? Where are the temporary files stored on this computer? Where is the OneDrive folder for this user account?

In Windows, environment variables have a name and value. For example, the variable windir (short for "Windows directory") may have the value "C:\Windows" or another path where you installed Windows.

Environment user and system variables in Windows 10

Another standard variable is named PATH. Many programs need to know where to find specific files, and the PATH variable tells them where they can find what they need. Those programs automatically look for a PATH variable, so you don’t have to type it all in every time you run the program. This variable has a value consisting of many user directories. These directories are set by the different applications installed on the computer, and they vary widely from system to system.

The concept of environment variables exists in most operating systems, from Linux to macOS to Windows. In principle, they mean the same thing but the way they are implemented and used differs.

Types of environment variables: user variables and system variables

There are two types of variables: user variables, specific to each user account, and system variables that apply to all user accounts.

User environment variables have values that differ from user to user. As their name implies, they are specific to your user account. They store user-specific data, like the location of your user profile, the folder where temporary files are stored for your account, the location of your OneDrive folder, and so on. That user account can edit them, but other user accounts cannot. These variables can be created and edited by the user, by Windows, or by different programs working with user-specific locations.

System variables are global and cannot be changed by any user. Their values are the same for all user accounts. They refer to critical system resource locations, like the folder where Windows is installed, the location of Program Files, and so on. These variables are set by Windows, different programs, and drivers.

Where can I find the environment variables from Windows?

In Windows 10, use the search box on the taskbar to look for environment. Then, click or tap on the “Edit the system environment variables” search result.

Using search to open the enviroment variables in Windows 10

In Windows 7, type environment in the Start Menu search box. Then, click on “Edit environment variables for your account” or “Edit the system environment variables.”

Using search to open the enviroment variables in Windows 7

Alternatively, if you use Windows 10, you can use the Settings app to access the environment user and system variables. In the Settings, go to System, and select the About page on the left sidebar. Then, click or tap on “Advanced system settings.” It opens the System Properties window, where you can press the Environment Variables button from the Advanced tab.

Using Settings to find the enviroment variables in Windows 10

Similarly, to access your environment user and system variables in Windows 7, you can use the Control Panel. In the Control Panel, go to System and Security and then to System. On the left, click or tap the “Advanced system settings” link, which opens the System Properties window. In its Advanced tab, press the Environment Variables button highlighted below.

Using Control Panel to open the enviroment variables in Windows 7

In any Windows operating system, you can also use the Run window (Win + R) to access your environment variables if you know what command to type. In this window, type the command rundll32.exe sysdm.cpl,EditEnvironmentVariables, and press Enter or click OK.

rundll32.exe sysdm.cpl,EditEnvironmentVariables

Regardless of which method you chose to use, the Environment Variables window should be open now.

At the top, the Environment Variables displays your user variables, and on the bottom, it shows the system variables, valid for all user accounts existing in Windows.

Environment Variables window in Windows

How to view environment variables in the Command Prompt or PowerShell

If you are a fan of the Command Prompt, you can see all the environment variables with the command set, without any other parameters. Start the Command Prompt in Windows, type set, and press Enter.

Use set to get the list of environment variables in CMD

If you prefer PowerShell, open it, type the command Get-ChildItem Env: and press Enter.

Use Get-ChildItem Env: to get the list of environment variables in PowerShell

All the environment variables are listed, but they are not split depending on their type (user or system variables).

If you want to see only the system variables, in PowerShell, use this command instead: [Environment]::GetEnvironmentVariables("Machine").

List of system variables in PowerShell: [Environment]::GetEnvironmentVariables("Machine")

And if you want to list only the user variables, run this command: [Environment]::GetEnvironmentVariables("User").

List of user variables in PowerShell: [Environment]::GetEnvironmentVariables("Machine")

Which are the standard environment variables in Windows?

There is a long list of variables existing on each Windows computer. The most used are variables like OS, PATH, and TEMP. You can find the entire list and all their default values on Wikipedia: Environment variables - Default Values on Microsoft Windows.

What are you using environment user and system variables for?

Now you know how to answer the question: “What are environment variables?”. As you can see from this tutorial, environment variables are neither easy to find nor visible in any way while working with Windows programs. They are managed in the background by the operating system and the different programs and drivers you install. However, they are essential to the proper functioning of the operating system and of your installed apps. If you change the value of essential system variables without knowing what you are doing, you will get to experience just how vital these environment variables are by causing your system to malfunction. Before you go, comment below and tell us how you are using environment variables in Windows.

Discover: Productivity Recommended System and Security Tutorials Windows
Join the discussion: See the comments Comment