What Are Environment Variables?

User & System Environment Variables & How to Find Their Values

An environment variable is a dynamic value that the operating system and other software can use to determine information specific to your computer.

In other words, an environment variable is something that represents something else, like a location on your computer, a version number, a list of objects, etc.

Environment variables are surrounded by the percent sign (%), as in %temp%, to distinguish them from regular text.

Two types of environment variables exist: user environment variables and system environment variables.

User Environment Variables

User environment variables, as the name suggests, are environment variables that are specific to each user account.

This means that the value of an environment variable when logged in as one user can be different than the value of the same environment variable when logged in as a different user on the same computer.

These types of environment variables can be manually set by whatever user is logged in, but Windows and other software can set them as well.

One example of a user environment variable is %homepath%. For example, on one Windows 11 computer, that variable holds the value of \Users\Tim, which is the folder that contains all the user-specific information.

A user environment variable could be custom, too. A user could create something like %data%, which may point to a folder on the computer like C:\Downloads\Files. An environment variable like this would only work when that specific user is logged in.

You might use a custom user environment variable if you want to use shortcuts to get around your computer. Or, if you were thinking ahead and built a script that points to an environment variable, you can always change the folder later without having to adjust all the code in the script.

System Environment Variables

System environment variables extend beyond just one user, applying to any user that might exist, or is created in the future. Most system environment variables point to important locations like the Windows folder.

Some of the most common environment variables in Windows systems include %path%, %programfiles%, %temp%, and %systemroot%, though there are many others.

For example, when you install Windows, the %windir% environment variable is set to the directory in which it's installed to. Since the installation directory is something the installer (that's you...or your computer maker) can define in one computer, it might be C:\Windows, but in another, it may be C:\Win10.

Continuing with this example, let's say Microsoft Word is installed on each of these computers after Windows is done setting up. As part of the Word installation process, a number of files need to be copied to the directory that Windows is installed in. How can Word be sure it's installing the files in the right place if that place is C:\Windows on one computer and C:\Win10 on the other?

To prevent a potential problem like this, Microsoft Word, as well as most software, was designed to install to %windir%, not any specific folder. This way, it can be sure that these important files are installed in the same directory as Windows, no matter where that might be.

See Microsoft's Recognized Environment Variables page for a giant list of user and system environment variables often used in Windows.

How Do You Find the Value of an Environment Variable?

There are several ways to see what a particular environment variable happens to be. However, in most cases, at least in Windows, the most simple, and probably fastest, way to do this is via a simple Command Prompt command called echo.

Here's how to do it:

  1. Open Command Prompt.

  2. Execute the following command exactly:

    echo %temp% 

    ...of course, substituting %temp% for the environment variable you're interested in.

    echo temp command in Windows 10 Command Prompt

Note the value that's displayed immediately underneath. For example, echo %temp% might produce this:


You can also use Windows PowerShell to see what a particular environment variable points to, but the syntax is a bit different:

Write-Output $env:temp

If the Command Prompt scares you (it shouldn't), there's a longer way to check out the value of an environment variable without using command line tools.

Head to Control Panel, then the System applet. Once there, choose Advanced system settings, then Environment Variables at the bottom. This is an incomplete list of environment variables, but the ones that are listed have the values right next to them.

Windows 11 environment variables

On Linux systems, you can execute the printenv command from the command line to list all the environment variables that are currently defined.

Was this page helpful?