In other words, it’s 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 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 a variable when logged in as one user can be different than the value of the same 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, %windir% 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 somewhere else 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 to Find the Value of an Environment Variable
There are several ways to see what a particular environment variable happens to be.
Command Prompt Echo Command
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. Open Command Prompt and execute the following command exactly, of course, substituting %temp% for the environment variable you’re interested in: Note the value that’s displayed immediately underneath. For example, echo %temp% might produce this: To list all the environment variables at once, just execute set from the command line. Or, try set user for a list of all the variables that start with user (it works with any prefix). The output looks something like this, where the variable’s name is listed first, followed by =, and then the value:
PowerShell Write-Output Command
You can also use Windows PowerShell to see what a particular environment variable points to, but the syntax is a bit different. Here are two ways to do it: Use this command to see all the variables listed together:
System Properties
If command line tools scare you (they shouldn’t), there’s a longer way to check out the value of an environment variable. 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, but the ones that are listed have the values right next to them.
Linux printenv Command
On Linux systems, you can execute the printenv command from the command line to list all the environment variables that are currently defined.