Simple Questions: What are Environment Variables in Windows?

Have you ever heard about environment variables? Maybe some IT admin or geek was mentioning them or some program started malfunctioning and returning errors mentioning such variables? Whatever the reason you want to learn more about them, you arrived at the right place. This article will share everything you need to know about what they are, how they work and why they are important.

What are Environment Variables in Windows?

This concept exists in most operating systems, from Linux to OS X to Windows. In principle they mean the same thing but the way they are implemented and used differs.

Environment variables are, in short, variables that describe the environment in which programs run in. They are used by all kinds of programs and scripts to answer questions like: What is the name of the computer where I am installed? What is the name of the user running me? What is my current working directory? Where is Windows installed? Where are temporary files stored?

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

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

Types of Environment Variables: User and System

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

User variables have values that differ from user to user. As their name implies, they are specific to your user account and they store user specific data, like the location of your user profile, the folder where temporary files are stored, etc. They can be edited by that user account but not by other user accounts. These variables can be set 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 generally refer to locations of important system resources, like the folder where Windows is installed, the location for program files, etc. These variables are set by Windows, by different programs and drivers.

Which are the Standard Environment Variables in Windows?

There is a long list of variables existing on each and every computer. You can find the entire list and all their default values on Wikipedia: Environment variables - Default Values on Microsoft Windows.

Where to Find the Environment Variables Existing in Windows?

Viewing the environment variables existing in Windows involves quite a few steps. In Windows 8, type the word environment while in the Start screen, filter by Settings and two search results will be displayed: "Edit environment variables for your account" and "Edit the system environment variables". Click or tap any of them.

In Windows 7, type environment in the Start Menu search box and the same search results are returned. A click on any of them launches the Environment Variables window.

Alternatively, you can use the Control Panel. Go to System and Security and then to System. In the column on the left, click or tap Advanced system settings. This opens the System Properties window.

Then, in the Advanced tab, click Environment Variables. The Environment Variables window looks the same in all recent versions of Windows.

On the top, it displays your user’s variables and on the bottom it displays the system variables, valid for all user accounts existing in Windows.

If you are a fan of the Command Prompt, you can view all the environment variables by typing the command: SET, without any other parameters.

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

NOTE: The fact that you can find them does not mean you should play around with them unless you are sure you know what you are doing.

Conclusion

As you can see from this article, environment variables are not that easy to find nor visible in any way, while working with Windows. They are managed in the background by the operating system and the different programs and drivers you install. However, they are important to the proper functioning of the operating system and of your installed programs. If you change the value of an important variable, you will get to learn just how important these variables are. :)