Home » How To » List Environment Variables in Windows: A Comprehensive Guide

List Environment Variables in Windows: A Comprehensive Guide

Environment Variables allow you to access or open a specific object, path, folder, or drive with a pre-defined named variable. For example, instead of using the full path “C:\Users\UserName\AppData\Local\Temp” to open the local temp folder, you can use the “%temp%” environment variable, which is easy to remember.

You can think of Environment Variables as an easy-to-remember shortcut or placeholder.

Windows has several useful Environment Variables that can make your life easy when navigating folders, adding paths to applications, creating custom scripts, and more. To get you started, here is a comprehensive list of Windows Environment Variables that every Windows user should know.

Table of contents:

  1. Windows Environment Variables list
  2. Display Environment Variables list in Command Prompt
  3. Display Environment Variables list in PowerShell
  4. What are Environment Variables in Windows?
  5. Types of Environment Variables
  6. How to use Environment Variables in Windows
  7. How to export Environment Variables windows
  8. How to import Environment Variables windows
  9. Frequently asked questions (FAQs)
  10. Conclusion
Windows Environment Variables list

Windows Environment Variables List

Here is a list of all Environment Variables in Windows.

Environment VariablePath/Output
%SystemDrive%C:\ (Operating System drive)
%SystemRoot%C:\Windows
%WINDIR%C:\Windows
%HOMEDRIVE%C:\ (Operating System drive)
%HOMEPATH%C:\Users\[username]
%USERPROFILE%C:\Users\[username]
%APPDATA%C:\Users\[username]\AppData\Roaming
%ALLUSERSPROFILE%C:\ProgramData
%PROGRAMFILES% or %ProgramW6432%C:\Program Files
%PROGRAMFILES(X86)%C:\Program Files (x86)
%PROGRAMDATA%C:\ProgramData
%TEMP% or %TMP%C:\Users\[username]\AppData\Local\Temp
%LOCALAPPDATA%C:\Users\[username]\AppData\Local
%PUBLIC%C:\Users\Public
%COMMONPROGRAMFILES% or %CommonProgramW6432%C:\Program Files\Common Files
%COMMONPROGRAMFILES(x86)%C:\Program Files (x86)\Common Files
%PSModulePath%C:\Program Files\WindowsPowerShell\Modules or C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
%OneDrive% or OneDriveConsumer%%C:\Users\[username]\OneDrive
%LOGONSERVER%Outputs your computer’s network path (\\ComputerName)
%COMPUTERNAME%Outputs your computer name.
%NUMBER_OF_PROCESSORS%Outputs the number of cores in your CPU.
%OS%Outputs OS name.
%PROCESSOR_ARCHITECTURE%Outputs your processor architecture.
%PROCESSOR_IDENTIFIER%Output the processor identifier information.
%PROCESSOR_LEVEL%Output your processor level. It helps configure the processor architecture.
%PROCESSOR_REVISION%Output the current processor revision.
%SESSIONNAME%Outputs the current session name.
%USERDOMAIN%Output the current domain name.
%USERDOMAIN_ROAMINGPROFILE%Outputs the current user’s roaming profile name.
%USERNAME%Outputs the username of the current user.
%RANDOM%Output a random number between 0 and 32767.
%DATE%Outputs the current date according to timezone settings.
%TIME%Outputs the current time according to timezone settings.
%CD%Outputs current directory path.

Do keep in mind that some folders or paths have multiple Environment Variables and can be used interchangeably.

Additionally, along with all the variables shared above, your system might have custom variables created by other users or applications. If you are curious, I’ve shown below how to display all the Environment Variables in your system using Command Prompt and PowerShell.

Display Environment Variables list in Command Prompt

To display a list of all the available Environment variables in your system using Command Prompt, you can use the “set” cmd. Here’s how.

  1. Open the Command Prompt window.
  2. Type the “set” cmd in Command Prompt.
  3. Press the “Enter” key.
  4. The command window displays all Environment Variables.

Steps with more details:

First, open the Command Prompt window. You can search for it in the Start menu. If you are a Windows Terminal user, right-click on the Start icon on the taskbar, select “Terminal,” and then open “Command Prompt” in it.

Type “set” and press the “Enter” key on your keyboard to display a list of all the Environment Variables in your system.

display Environment Variables in command prompt

Display Environment Variables list in PowerShell

Want to display all the Environment Variables in PowerShell? Here’s how you can do it in simple steps.

  1. Open the PowerShell window.
  2. Type the “Get-ChildItem Env: | Sort Name” cmd in PowerShell.
  3. Press the “Enter” key.
  4. The PowerShell window displays all Environment Variables.

Steps with more details:

First, open the PowerShell window. You can search for it in the Start menu. Windows 11 users can also use the Terminal. To open the terminal, right-click on the taskbar Start icon and select “Terminal.” PowerShell is the default tab in the Terminal. If not, you can open it from the title bar dropdown menu.

Type the below command in the PowerShell window and press the “Enter” key on your keyboard to display a list of all the Environment Variables in your system.

 Get-ChildItem Env: | Sort Name

Alternatively, you can also use the below PowerShell command to display all Environment Variables.

 gci env:* | sort-object name
display Environment Variables in powershell

What are Environment Variables in Windows?

Environment Variables are dynamic values that can store and represent various types of information, such as the location of a folder, a list of objects, specific text, etc. These values are specific to your system, user account, or application.

To put it simply, you can think of Environment Variables as shortcuts for your computer. For example, the “USERPROFILE” variable stores the location of your home folder. This variable is dynamic, meaning it changes depending on the user account from which it is called.

To use an Environment Variable in Windows, you need to surround it with the “percent” symbol (%). For example, “%USERPROFILE%”.

Environment Variables are commonly used to quickly and easily access files and folders, set the system’s path to locate applications, create custom command-line scripts, help with debugging and testing, and more.

Types of Environment Variables

There are two types of Environment Variables in Windows. They are the System Variables and User Variables.

System Variables are set by the system and are available to all users on the computer. You can add, modify, or remove a variable from System Variables when needed. Examples of System Variables include the PATH variable, which tells the system where to find executable files, and the TEMP variable, which points to the location of the temporary files folder.

User Variables, on the other hand, are set by the user and are specific to the user account. Other users on the system cannot access these variables. Examples of User Variables include the HOME variable, which points to the user’s home folder, and the USERPROFILE variable, which points to the user’s profile folder.

It’s worth noting that some variables can exist in both System and User Variables. For instance, the PATH variable, which tells the system where to find an application’s executable file, is available in both System and User Variables.

In these cases, the System Variables take precedence over User Variables. This means that if you set a User Variable with the same name as a System Variable, the user’s variable will not be used.

How to use Environment Variables

Now that you know what Environment Variables are and how to display a list of them when needed, you might be wondering how to use these Environment Variables. There are a variety of ways to use Environment Variables in Windows. Here are two of the most common methods:

Opening Folders in File Explorer

To use an environment variable in File Explorer, follow these steps:

  1. Open File Explorer by clicking on the taskbar icon or pressing the keyboard shortcut Win + E.
  2. In the address bar, type the environment variable and press Enter. For example, you can use the %USERPROFILE% environment variable to open your home folder.
using Environment Variables in file explorer

Opening Folders in the Run Dialog Box

To use an environment variable in the Run dialog box, follow these steps:

  1. Open the Run dialog box by pressing the keyboard shortcut “Windows logo key + R.”
  2. Type the environment variable in the dialog box and press Enter. The corresponding folder will open. For instance, you can use %temp% to open the Windows Temp folder.
using Environment Variables in run dialog box

Using Environment Variables in Scripts

Apart from opening folders, you can also use Environment Variables in script files. That way, you don’t have to hard code paths. For example, you can use the %TEMP% environment variable to access the temporary files folder in a script, rather than typing out the full path. Since the path is not hard coded, you can share the script with others and be sure that it works.

For instance, if you are creating a script to automate specific Windows tasks, monitor folders, tell Windows where to look for certain applications, etc., the Environment Variables are quite helpful.

How to export Environment Variables windows

The Windows Environment Variables are stored in the Registry Editor. Specifically, both System and User variables are stored in separate registry keys. That means, to back up the Environment Variables in Windows, you have to export both registry keys. It sounds complicated, but it is really easy.

Here’s how to backup or export Environment Variables in Windows:

  1. Press the “Start” key on your keyboard.
  2. Search and open “Registry Editor.”
  3. Go to the “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment” folder.
  4. Right-click on the “Environment” folder.
  5. Select the “Export” option.
  6. Select a save location and type a file name.
  7. Press the “Save” button.
  8. Go to the “HKEY_CURRENT_USER\Environment” folder.
  9. Right-click on the “Environment” folder.
  10. Select the “Export” option.
  11. Select a save location and type a file name.
  12. Press the “Save” button.
  13. Close the Registry Editor.
  14. With that, the Environment Variables are backup/exported.

How to import Environment Variables windows

To import Environment Variables, you must import the backed-up Environment Variables registry keys. So, make sure you have the files ready and follow the steps below.

Here’s how to import Environment Variables in Windows:

  1. Find the System Variables reg file.
  2. Double-click on the reg file.
  3. Click “Yes” in the UAC prompt.
  4. Press the “Yes” button in the Registry prompt.
  5. Click “Ok” in the confirmation prompt.
  6. This action will import the System Variables.
  7. Next, find and double-click on the User Variables reg file.
  8. Double-click on the reg file.
  9. Click “Yes” in the UAC prompt.
  10. Press the “Yes” button in the Registry prompt.
  11. Click “Ok” in the confirmation prompt.
  12. With that, you’ve imported Environment Variables in Windows.

Frequently asked questions (FAQs)

Here are a few frequently asked questions about Windows Environment Variables:

How do I access Environment Variables in Windows?

To access Environment Variables, press the “Start” key on your keyboard, search & open “Edit the system Environment Variables,” and click on the “Environment Variables” button. From here, you can access both System and User variables.

How do I create a new Environment Variable in Windows?

To create a new Environment Variable, open the “Environment Variables” window, click on the “New” button under either the “User variables” or “System variables” section, enter the name and value of the new Environment Variable and click “Ok.”

Can I modify or delete an existing Environment Variable in Windows?

To modify an existing Environment Variable, open the “Environment Variables” window, select the variable under either the “User variables” or “System variables” section and click the “Edit” button. Make the necessary changes and click “Ok” to save changes. To delete an Environment Variable, select the variable and click the “Delete” button. Be cautious while deleting variables, and never delete system variables.

What is the PATH variable in Windows, and what does it do?

The PATH variable in Windows is an environment variable that tells the system where to look for executable files. It is a list of directories separated by semicolons (;) in which Windows will search for executables.

How do I refresh Environment Variables in Windows?

You can refresh Environment Variables by restarting the system. If you don’t want to restart, open the Command Prompt Window, run the “set PATH=C” cmd, and restart the Command Prompt application.

Windows Environment Variables — Conclusion

In conclusion, Windows Environment Variables play a crucial role in the functioning of the operating system and make it easier for you to access important system folders and files. If you ever need, refer to the comprehensive list of Windows Environment Variables in this article to get a clear understanding of the different types of Environment Variables and their uses.

That is all. It is that simple to list Environment Variables in Windows.

I hope this simple and easy Windows how-to guide helped you.

If you like this article, check out the Windows app URI commands list and how to check the PowerShell version.

2 thoughts on “List Environment Variables in Windows: A Comprehensive Guide”

  1. Avatar for AnNa

    There is (at least) one error given on this page:
    %HOMEPATH% C:\Users\
    %USERPROFILE% C:\Users\
    should be:
    %HOMEPATH% Users\
    %USERPROFILE% C:\Users\

Leave a Comment

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

Scroll to Top