Tips & Tricks

Environment Variables in Windows: Usage, List, and Tables

An environment variable is a text short link to an element of the Windows operating system, designed to get quick access to a system object, or to information about directories and computer configuration. An environment variable (environment variable) allows you to quickly navigate to a desired location on your computer without using a username or full path to an object.

Windows environment variables are used on the command line, in the Run dialog box, and in the File Explorer address bar. An environment variable can contain information about system settings or information about the current user of the computer.

Windows environment variables are divided into two types:

  • User environment variables – contain paths to user directories.
  • System environment variables – contain information about OS directories and PC configuration.

Most often, environment variables are used as a path to drives, files, or system settings. Using an environment variable allows you to quickly navigate to the desired directory of the operating system, without entering the full path, for example, without entering a username.

Environment variables are often used when writing scripts, or when working on the command line. Short variables can be used instead of the full path to a file or folder, for example, when creating shortcuts, when entering the path to an object.

Windows environment variable example

Let’s consider the following example: the user needs to open the “AppData” system folder, which contains various data of programs installed in the Windows operating system. The hidden folder “AppData” is located in the user’s profile, usually on the “C:” drive. Application data is located along the path:

C:\Users\UserName\AppData\Roaming

To access this folder, you need to perform several sequential steps: open Explorer, turn on the display of hidden folders and files in Windows, and then go all the way to the desired folder.

Using the “%APPDATA%” variable (the variable is used without quotes), you can immediately open the desired directory in the system, without entering a username, enabling the display of hidden folders, or entering the full path. This saves a lot of time.

To open the desired directory, you just need to enter “%APPDATA%” in the Windows search field, in the Explorer address bar or in the Run dialog box, and then press the “Enter” key.

Windows environment variables are enclosed in a special operator “%”, which is located on both sides of the variable name. This is necessary for the system to process the request.

The user can independently create environment variables or modify existing ones. In this article, we will look at several ways to view environment variables and create a variable yourself. In the guide you will find a table with a list of variables used in Windows 10, Windows 8.1, Windows 8, Windows 7 operating systems.

How to View Windows 10 Environment Variables

Now we will see how to access environment variables in the Windows 10 operating system. In other versions of Windows, you need to follow similar steps.

To view Windows 10 environment variables, run the following:

  1. Press the “Win” + “R” keys.
  2. In the “Run” window, enter the command: “systempropertiesadvanced” (without quotes), and then click on the “OK” button.
  3. In the “System Properties” window, in the “Advanced” tab, click on the “Environment Variables …” button.
  4. The Environment Variables window displays user environment variables and system environment variables.

Accessing Environment Variables from the Windows Registry

It is possible to access environment variables from the Windows system registry. The user will need to open the registry editor , and then follow the path to a specific branch.

The system environment variables are located in the following path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

Local user environment variables are located in the following registry branch:

HKEY_CURRENT_USER\Environment

You can create new variables in the Registry Editor or modify existing ones.

How to view all environment variables on the command line

The user can get a list of environment variables using a system tool – the Windows command line.

In cmd, environment variables are opened like this:

  1. Run command prompt as administrator.
  2. Run the command:
set

To get the list of variables in the form of a text file, run the following command on the command line:

set > C:\Variables.txt

After executing this command, a text file with the name “Variables” (you can use any name) will appear on the Local drive “C:”, which contains a list of Windows environment variables.

On my computer, the file has the following content:

ALLUSERSPROFILE=C:\ProgramData

APPDATA=C:\Users\User\AppData\Roaming

CommonProgramFiles=C:\Program Files\Common Files

CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files

CommonProgramW6432=C:\Program Files\Common Files

COMPUTERNAME=DESKTOP-3HEECRJ

ComSpec=C:\WINDOWS\system32\cmd.exe

DokanLibrary1=C:\Program Files\Dokan\DokanLibrary-1.2.2\

DriverData=C:\Windows\System32\Drivers\DriverData

HOMEDRIVE=C:

HOMEPATH=\Users\User

LOCALAPPDATA=C:\Users\User\AppData\Local

LOGONSERVER=\\DESKTOP-3HEECRJ

NUMBER_OF_PROCESSORS=4

OneDrive=C:\Users\User\OneDrive

OneDriveConsumer=C:\Users\User\OneDrive

OS=Windows_NT

Path=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\ v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\ Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\ Users\User\AppData\Local\Microsoft\WindowsApps

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

PROCESSOR_ARCHITECTURE=AMD64

PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 60 Stepping 3, GenuineIntel

PROCESSOR_LEVEL=6

PROCESSOR_REVISION=3c03

ProgramData=C:\ProgramData

ProgramFiles=C:\Program Files

ProgramFiles(x86)=C:\Program Files (x86)

ProgramW6432=C:\Program Files

PROMPT=$P$G

PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

PUBLIC=C:\Users\Public

SystemDrive=C:

SystemRoot=C:\WINDOWS

TEMP=C:\Users\User\AppData\Local\Temp

TMP=C:\Users\User\App\Data\Local\Temp

TMPDIR=C:\Users\Public\Documents\Wondershare\Creator\Temp

USERDOMAIN=DESKTOP-3HEECRJ

USERDOMAIN_ROAMINGPROFILE=DESKTOP-3HEECRJ

USERNAME=User

USERPROFILE=C:\Users\User

windir=C:\WINDOWS

Opening the list of environment variables in Windows PowerShell

Opening the list of environment variables is possible using the Windows PowerShell system tool.

Do the following:

  1. Run Windows PowerShell as an administrator.
  2. Type the command, and then press the “Enter” key:
dirEnv:
  1. A PowerShell window opens with a list of Windows environment variables.

Creating an Environment Variable in Windows

The user can independently create a new variable to open directories on the computer, or to launch programs.

Before making changes to environment variables, be aware that mindlessly changing the values ​​of Windows environment variables can lead to crashes or malfunctions of the operating system.

Do the following:

  1. In the Environment Variables window, select one of the variable groups: user variables or system variables.
  2. Click on the “Create…” button.

In this example, I will create a separate environment variable to start the TeamViewer program.

  1. In the Edit User Variable window, add a variable name, and in the Variable Value: field, enter the full path to the executable file.
  2. A new variable has been added to the Environment Variables window. Click on the “OK” button to apply the changes.
  3. In the “Run” dialog box, enter “%VariableName%”, in our case, “%TeamViewer%”, click on the “OK” button.
  4. A window of the running program will open on the desktop of the computer.

In a similar way, after entering a variable in the Explorer address bar, the program is launched or a directory is opened on the PC.

The path environment variable “Path” contains a list of directories on the computer in which the system should look for executable files. The path environment variable “PATH” is not added to executable files, but only to the directories where these files are located.

If you add the path to the directory with the executable file to the Path Windows environment variable, for example, for the Google Chrome browser: C:\Program Files (x86)\Google\Chrome\Application, then the program will be launched from the command line after executing the “chrome” command, without entering the full path to the executable file.

If necessary, the user can remove an unnecessary variable from the Windows operating system.

List of Windows environment variables in a table

For the convenience of site visitors, I have collected variables, their description and values ​​in the Windows operating system in a common table. In the vast majority of cases, the system folder is located on the C: drive, so the paths in the values ​​are given for this drive.

Variable Purpose Variable value
%ALLUSERSPROFILE% ProgramData folder C:\ProgramData
%APPDATA% Program Data Folder C:\Users\User\AppData\Roaming
%CommonProgramFiles% Common Files folder in Program Files C:\Program FilesCommon Files
%CommonProgramW6432% Common Files folder in Program Files C:\Program Files\Common Files
%COMPUTERNAME% Computer name DESKTOP-XXXXXXX
%ComSpec% Command line launch C:\WINDOWS\system32\cmd.exe
%DriverData% DriverData folder C:\Windows\System32\Drivers\DriverData
%HOMEDRIVE% System disk C:
%HOMEPATH% User profile folder C:\Users\User
%LOCALAPPDATA% Application local data folder C:\Users\User\AppData\Local
%LOGONSERVER% Domain controller name \DESKTOP-XXXXXXX
%NUMBER_OF_PROCESSORS% Number of processor threads
%OneDrive% OneDrive folder C:\Users\User\OneDrive
%Path% Executable Search Path C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;…
%PATHEXT% Executable file extensions .com; .EXE; .bat; .CMD; .VBS; .VBE; .js .jse .WSF; .WSH; .MSC
%PROCESSOR_ARCHITECTURE% Processor architecture AMD64; x86; IA64
%PROCESSOR_IDENTIFIER% Processor Description
%PROCESSOR_LEVEL% Processor Model Number
%PROCESSOR_REVISION% Processor revision
%ProgramData% ProgramData folder C:\ProgramData
%ProgramFiles% ProgramFiles folder C:\Program Files
%ProgramFiles(x86)% Folder ProgramFiles(x86) C:\Program Files (x86)
%ProgramW6432% ProgramFiles folder C:\Program Files
%PROMPT% Returning command line options
%PSModulePath% PowerShell Module Location Paths C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
%PUBLIC% The “General” folder in the user profile C:\Users\Public
%SystemDrive% Windows system drive C:
%SystemRoot% Windows folder C:\Windows
%TEMP% Temp directory C:\Users\User\AppData\Local\Temp
%TMP% Temp directory C:\Users\User\AppData\Local\Temp
%USERDOMAIN% domain name DESKTOP-XXXXXXX
%USERNAME% Username user
%USERPROFILE% User profile C:\Users\User
%Windir% Windows folder C:\Windows

Article Conclusions

Windows environment variables allow the user to save time while working on the computer. Windows environment variables can be used by ordinary users or system administrators to quickly access operating system objects to open a desired directory on a computer or run a program.

Leave a Reply

Your email address will not be published. Required fields are marked *