How to check environment variable in windows

This tutorial covers different ways to set, view, and unset environment variables in Windows using the GUI, Command Prompt and PowerShell.

Introduction

Environment variables are key-value pairs a system uses to set up a software environment. The environment variables also play a crucial role in certain installations, such as installing Java on your PC or Raspberry Pi.

In this tutorial, we will cover different ways you can set, list, and unset environment variables in Windows 10.

How to set environment variables in Windows

Prerequisites

  • A system running Windows 10
  • User account with admin privileges
  • Access to the Command Prompt or Windows PowerShell

Check Current Environment Variables

The method for checking current environment variables depends on whether you are using the Command Prompt or Windows PowerShell:

List All Environment Variables

In the Command Prompt, use the following command to list all environment variables:

set
List all environment variables using the Command Prompt

If you are using Windows PowerShell, list all the environment variables with:

Get-ChildItem Env:
List all environment variables using Windows PowerShell

Check A Specific Environment Variable

Both the Command Prompt and PowerShell use the echo command to list specific environment variables.

The Command prompt uses the following syntax:

echo %[variable_name]%
Checking a specific environment variable using the Command Prompt

In Windows PowerShell, use:

echo $Env:[variable_name]
Checking a specific environment variable using Windows PowerShell

Here, [variable_name] is the name of the environment variable you want to check.

Follow the steps to set environment variables using the Windows GUI:

1. Press Windows + R to open the Windows Run prompt.

2. Type in sysdm.cpl and click OK.

Run sysdm.cpl

3. Open the Advanced tab and click on the Environment Variables button in the System Properties window.

Find the Environment Variables button in the Advanced tab

4. The Environment Variables window is divided into two sections. The sections display user-specific and system-wide environment variables. To add a variable, click the New… button under the appropriate section.

Click on the New... button to add a variable

5. Enter the variable name and value in the New User Variable prompt and click OK.

Enter the new variable name and value

Set Environment Variable in Windows via Command Prompt

Use the setx command to set a new user-specific environment variable via the Command Prompt:

setx [variable_name] "[variable_value]"

Where:

  • [variable_name]: The name of the environment variable you want to set.
  • [variable_value]: The value you want to assign to the new environment variable.

For instance:

setx Test_variable "Variable value"
Setting a user-specific environment variable via the Command Prompt

Note: You need to restart the Command Prompt for the changes to take effect.

To add a system-wide environment variable, open the Command Prompt as administrator and use:

setx [variable_name] "[variable_value]" /M
Setting a system environment variable via the Command Prompt

Unset Environment Variables

There are two ways to unset environment variables in Windows:

Unset Environment Variables in Windows via GUI

To unset an environment variable using the GUI, follow the steps in the section on setting environment variables via GUI to reach the Environment Variables window.

In this window:

1. Locate the variable you want to unset in the appropriate section.

2. Click the variable to highlight it.

3. Click the Delete button to unset it.

Unset environment variables in Windows via GUI

Unset Environment Variables in Windows via Registry

When you add an environment variable in Windows, the key-value pair is saved in the registry. The default registry folders for environment variables are:

  • user-specific variables: HKEY_CURRENT_USEREnvironment
  • system-wide variables: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment

Using the reg command allows you to review and unset environment variables directly in the registry.

Note: The reg command works the same in the Command Prompt and Windows PowerShell.

Use the following command to list all user-specific environment variables:

reg query HKEY_CURRENT_USEREnvironment
Listing all user-specific environment variables in the registry

List all the system environment variables with:

reg query "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment"
Listing all system environment variables in the registry

If you want to list a specific variable, use:

reg query HKEY_CURRENT_USEREnvironment /v [variable_name]
Listing a specific user environment variable in the registry

or

reg query "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment" /v [variable_name]
Listing a specific system environment variable in the registry

Where:

  • /v: Declares the intent to list a specific variable.
  • [variable_name]: The name of the environment variable you want to list.

Use the following command to unset an environment variable in the registry:

reg delete HKEY_CURRENT_USEREnvironment /v [variable_name] /f
Unsetting a user-specific environment variable from the registry

or

reg delete "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment" /v [variable_name] /f
Unsetting a system environment variable from the registry

Note: The /f parameter is used to confirm the reg delete command. Without it, entering the command triggers the Delete the registry value EXAMPLE (Yes/No)? prompt.

Run the setx command again to propagate the environment variables and confirm the changes to the registry.

Note: If you don’t have any other variables to add with the setx command, set a throwaway variable. For example:

setx [variable_name] trash

Conclusion

After following this guide, you should know how to set user-specific and system-wide environment variables in Windows 10.

Looking for this tutorial for a different OS? Check out our guides on How to Set Environment Variables in Linux and How to Set Environment Variables in MacOS.

Is it possible to list all environment variables from a Windows’ command prompt?

Something equivalent to PowerShell’s gci env: (or ls env: or dir env:).

Plimpus's user avatar

Plimpus

29.4k12 gold badges105 silver badges149 bronze badges

asked Mar 16, 2011 at 15:22

Nicola Cossu's user avatar

Nicola CossuNicola Cossu

53.7k15 gold badges91 silver badges98 bronze badges

1

Just do:

SET

You can also do SET prefix to see all variables with names starting with prefix.

For example, if you want to read only derbydb from the environment variables, do the following:

set derby 

…and you will get the following:

DERBY_HOME=c:Usersamro-aDesktopdb-derby-10.10.1.1-bindb-derby-10.10.1.1-bin

Peter Mortensen's user avatar

answered Mar 16, 2011 at 15:24

Jon's user avatar

10

Jon has the right answer, but to elaborate a little more with some syntactic sugar..

SET | more

enables you to see the variables one page at a time, rather than the whole lot, or

SET > output.txt

sends the output to a file output.txt which you can open in Notepad or whatever…

Peter Mortensen's user avatar

answered Jul 10, 2013 at 15:26

Fetchez la vache's user avatar

Fetchez la vacheFetchez la vache

4,8104 gold badges34 silver badges53 bronze badges

1

To list all environment variables in PowerShell:

Get-ChildItem Env:

Or as suggested by user797717 to avoid output truncation:

Get-ChildItem Env: | Format-Table -Wrap -AutoSize

Source: Creating and Modifying Environment Variables (Windows PowerShell Tip of the Week)

Peter Mortensen's user avatar

answered Feb 17, 2015 at 8:03

user52028778's user avatar

user52028778user52028778

26.5k3 gold badges34 silver badges42 bronze badges

3

Simply run set from cmd.

Displays, sets, or removes environment variables. Used without parameters, set displays the current environment settings.

answered Mar 16, 2011 at 15:27

Grant Thomas's user avatar

Grant ThomasGrant Thomas

44.1k10 gold badges85 silver badges127 bronze badges

2

You can use SET in cmd

To show the current variable, just SET is enough

To show certain variable such as ‘PATH’, use SET PATH.

For help, type set /?.

answered Jan 13, 2015 at 6:57

Boyce Field's user avatar

1

Don’t lose time. Search for it in the registry:

reg query "HKLMSYSTEMCurrentControlSetControlSession ManagerEnvironment"

returns less than the SET command.

Peter Mortensen's user avatar

answered Feb 6, 2017 at 13:00

Paweł Piwowar's user avatar

2

As mentioned in other answers, you can use set to list all the environment variables or use

set [environment_variable] to get a specific variable with its value.

set [environment_variable]= can be used to remove a variable from the workspace.

Peter Mortensen's user avatar

answered Mar 24, 2017 at 4:44

Abhishek Gurjar's user avatar

Abhishek GurjarAbhishek Gurjar

7,41610 gold badges39 silver badges45 bronze badges

1

If you want to see the environment variable you just set, you need to open a new command window.

Variables set with setx variables are available in future command windows only, not in the current command window. (Setx, Examples)

Peter Mortensen's user avatar

answered Dec 5, 2016 at 4:55

captain puget's user avatar

Environment variables in an operating system are values that contain information about the system environment, and the currently logged in user. They existed in OSes before Windows as well, such as MS-DOS. Applications or services can use the information defined by environment variables to determine various things about the OS, for example, to detect the number of processes, the currently logged in user’s name, the folder path to the current user’s profile or the temporary files directory. In this article, we will see how to view environment variables defined in Windows 10 and their values for the current user and the system variables.

Windows 10 has several types of environment variables: user variables, system variables, process variables and volatile variables. User environment variables are accessible to all apps which run in the current user context, system environment variables apply to all users and processes on the PC; process variables are applicable only to a specific process and volatile variables are those which exist only for the current logon session. Most interesting of these are user, system and process variables, as we can modify them.

How to view user and system environment variables and their values

The most simple way to view the current user variables is to use the System Properties.

  1. Open the Control Panel.
  2. Navigate to the following applet:
    Control PanelSystem and SecuritySystem

    windows-10-system-properties

  3. Click the «Advanced System Settings» link on the left. In the next dialog, you will see the Environment Variables… button in the bottom of the Advanced tab.windows-10-advanced-system-properties Click it.
  4. The Environment Variables window will appear on the screen.windows-10-environment-variables
    In the upper table, you will see user variables, and the bottom list contains system-wide variables.
    Here you can view their names and values or even create your own variables, or edit the value of some variable if required.

There are several other ways to see environment variables.
You can see them at the appropriate registry keys.

  1. Open Registry Editor.
  2. To see user variables, go to the following key:
    HKEY_CURRENT_USEREnvironment

    Tip: How to jump to the desired registry key with one click.
    windows-10-registry-user-environment-variables

  3. To see system variables, navigate to the following key:
    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment

    windows-10-registry-system-environment-variables

Alternatively, you can view environment variables via the command prompt. Open the command prompt window, and type the following command and then press Enter:

set

The set command will print all available environment variables with their values, directly into the console output, so you will able to see them all at once.windows-10-cmd-set-environment-variables

If you want to see the value of a specific variable, then use the echo command instead of set, as follows:
echo %userprofile%
The command above will print the path to your account profile.
windows-10-echo-environment-variable
Replace userprofile with the desired name of the variable. For example, echo %computername%. That’s it.

That’s it. Now you know all the useful ways to see the names and values of variables defined in your Windows environment.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won’t take a lot from you, but it will help us grow. Thanks for your support!

Environment variables in an operating system are values that contain information about the system environment, and the currently logged in user. They existed in OSes before Windows as well, such as MS-DOS. Environment Variables are a set of dynamic named values that can affect the way running processes will behave on a computer. For example, a running process can query the value of the TEMP environment variable to discover a suitable place to store temporary files, or the AppData variable to find a quick way to get access to the Roaming folder in the user’s profile folder.

Applications or services can use the information defined by environment variables to determine various things about the OS, for example, to detect the number of processes, the currently logged in user’s name, the folder path to the current user’s profile or the temporary files directory.

Windows 10 has several types of environment variables: user variables, system variables, process variables and volatile variables. User environment variables are accessible to all apps which run in the current user context, system environment variables apply to all users and processes on the PC; process variables are applicable only to a specific process and volatile variables are those which exist only for the current logon session. Most interesting of these are user, system and process variables, as we can modify them.

In Windows, there are a few ways to discover how many of them are available and what their values are. The most simple way to view the current user variables is to use the System Properties.

Contents

  • To Find All Environment Variables in Windows 10
  • Find Windows 10 Environment Variables in Registry
  • Find Windows 10 Environment Variables in Command Prompt
    • Bonus tip
  • Find Windows 10 Environment Variables in PowerShell
  1. Open the Control Panel.
  2. Navigate to the following path: Control PanelSystem and SecuritySystem.
  3. Click the “Advanced System Settings” link on the left.System Properties Window Advanced Properties Link
  4. In the next dialog, you will see the Environment Variables… button in the bottom of the Advanced tab.System Properties - 2014-06-30 12_08_12
  5. The Environment Variables window will appear on the screen.Windows 10 New Environment Variables Editor
  6. You are done.

In the upper table, you will see user variables, and the bottom list contains system-wide variables.

Also, here you can view their names and values or even create your own variables, or edit the value of some variable if required.

Unfortunately, this lists most of the available variables but not all. Also, the System Properties window is hidden in Windows 10 version 20H2, and is completely removed in builds released after it. Here are some alternatives.

Find Windows 10 Environment Variables in Registry

  1. Open Registry Editor.
  2. To see user variables, go to the following key: HKEY_CURRENT_USEREnvironment.Windows 10 User Environment Variables In Registry
  3. To see system variables, navigate to the following key: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment.Windows 10 System Environment Variables In Registry
  4. You are done.

It’s quite tedious going through multiple steps to get your environment variable information. Here is a better way.

Find Windows 10 Environment Variables in Command Prompt

  1. Open a new command prompt window.
  2. Simply type the following command and then press Enter: set.
  3. The set command will print all available environment variables, so you will have a complete list of Environment Variables and their values.Command Prompt - SET to show the variables
  4. You are done.

Bonus tip

If you want to see the value of a specific variable, then use the echo command instead of set, as follows:
echo %userprofile%
The command above will print the path to your account profile.

Replace userprofile with the desired name of the variable. For example, echo %computername%.

Find Windows 10 Environment Variables in PowerShell

  1. Open PowerShell.
  2. To find and list all Environment Variables at once, typedir env:Windows PowerShell - dir env to list all environment variables
  3. The cmdlet will show you all available Environment variables.
  4. You are done.

The MSFTNEXT project is a small team of authors who love to engage with the latest technology and gadgets. Being passionate Windows bloggers, we are happy to help others fix their system issues. View all posts by The MFTNEXT Team

Windows environment variables are commonly-used short-cut commands to open a folder path in Windows. Whether you want to locate specific folders or troubleshoot a bug, you can perform these tasks quickly by typing environment variables in the Run menu or Command Prompt. The following is a complete list of system and user environment variables in Windows 10 and Windows 11.

Content

  • What Are Windows Environment Variables?
  • How to Access Environment Variables in Windows
  • System vs. User Environment Variables
  • 1. %AppData% and %LocalAppData%
  • 2. %CD%
  • 3. %CommonProgramFiles%
  • 4. %COMSPEC%
  • 5. %Date% or %Time%
  • 6. %DriverData%
  • 7. %HomeDrive%
  • 8. %LogOnServer%
  • 9. %Number_Of_Processors%
  • 10. %OneDrive%
  • 11. %OS%
  • 12. %Path%
  • 13. %PathExt%
  • 14. %Processor_Architecture%
  • 15. %Processor_Identifier%
  • 16. %Processor_Level%
  • 17. %Processor_Revision%
  • 18. %ProgramData%
  • 19. %ProgramFiles%
  • 20. %Prompt%
  • 21. %PSModulePath%
  • 22. %Public%
  • 23. %Random%
  • 24. %SessionName%
  • 25. %SystemRoot%
  • 26. %Temp%
  • 27. %UserDomain%
  • 28. %UserProfile%
  • 29. %WinDir%
  • 30. %ZES_ENABLE_SYSMAN%
  • Frequently Asked Questions

Environment variables in Windows are commands that launch a folder path using a brief text string within percent sign characters (%). The “environment” here refers to the runtime in which a program is executed. In fact, the purpose of these commands is to impact various running processes on your computer.

Popular environment variable examples are “%AppData%,” “DriverData%,” “%temp%,” and “%WinDir%.” You may have used them in Run menu or Command Prompt without actually knowing that they’re called environment variables.

How to Access Environment Variables in Windows

It’s very easy to check all the environment variables present on a Windows device.

  1. Launch “View advanced system settings” using the Search button (magnifying glass) in Windows.
List Environment Variables View Advanced System Settings
  1. Alternatively, open Settings using  Win +  I, tap on “System -> About -> Advanced system settings.”
  2. Go to the “Advanced” tab and click “Environment Variables” under “Startup and Recovery.”
List Environment Variables Accessing Environment Variables Windows11

System vs. User Environment Variables

From the above menu option, you can see all the default/standard environment variables in one place. These are further classified into two categories:

  • User environment variables: these refer to user-centric file and folder paths. You can add shortcuts to any program you use, such as OneDrive, Microsoft Office, an Xbox PC app, and more and can freely edit and even delete the contents of the user environment variables.
  • System environment variables: these are the system-centric file and folder paths. While you can add new system environment variables (only if missing). Do not edit or delete the existing ones, as that may harm your device.
List Environment Variables What Are Environment Variables

1. %AppData% and %LocalAppData%

%AppData% points toward the AppData Roaming folder that is connected to your Windows user profile. Roaming means that your user login information can be transferred from one Windows device to another. In contrast, %LocalAppData% opens local user profile folders created on a Windows PC.

Uses

  • Locating and clearing unnecessary files, settings, and data accumulating in AppData folders.
  • Admin user taking back full ownership of important system and registry files from TrustedInstaller.
List Environment Variables Appdata Windows11

2. %CD%

CD (change directory) is a common text string used to switch directory paths in Windows Command prompt and PowerShell. Thus, the %CD% variable tells you the precise execution directory in which you are running your code.

Uses

  • After scrolling through several lines of text in Command Prompt, it’s easy to forget which is the current working directory. Typing echo %CD% gives you the current one.
  • If running multiple Command prompts at once, %CD% saves you the trouble of identifying the correct working directory.
List Environment Variables Cd Command Windows11

3. %CommonProgramFiles%

The %CommonProgramFiles% variable refers to a Windows directory named “Common Files.” It contains many types of 64-bit files and folders shared among various apps. Another related variable, %CommonProgramFiles(x86)%, does the same job but for x86-based (32-bit) programs and utilities only.

Uses

  • The variable opens a sub-directory where you can view all of the files shared by separately-installed programs.
  • For any program, you can access common components present in both 64-bit and 32-bit folders. These include frameworks, Services, and DLL files.
List Environment Variables Common Program Files Windows11

4. %COMSPEC%

%COMSPEC% or %ComSpec% is a shortcut text entry used in the Run menu to open the Command Prompt. It uniquely displays the entire Command Line path “C:WindowsSystem32Cmd.exe” on the window title.

Uses

  • Engage with the Command Line directly from any location on your PC.
  • If you’re running a computer with no hard disk, you can boot the device by launching CMD along with a configured RAM disk and USB drive.
List Environment Variables Comspec Windows11

5. %Date% or %Time%

As the name suggests, the environment variables %Date% and %Time% are used to display the current date and time on your device. A correct output will confirm that the latest date and time settings are in effect.

Uses

  • This variable is used to verify whether the current system date and time are correct.
  • Changing the current date and time according to “mm-dd-yy” and the “0:hh:mm:ss” 24-hour format.
List Environment Variables Date Time Windows11

6. %DriverData%

%DriverData% is a variable that refers to the DriverData folder on your Windows PC. It is located at “C:WindowsSystem32Drivers.” This is a central folder containing all of your driver information.

Uses

  • As the folder is accessible to “System Restore,” SFC, and other internal processes, its variable is very handy for locating possible errors.
  • While installing any new hardware, use the variable to check whether the DriverData folder has been affected.
List Environment Variables Driverdata Windows11

7. %HomeDrive%

The all-important C: drive is crucial to everything you do on your system. A command like %HomeDrive% (or %SystemDrive%) helps you open and view the location for further activity.

Uses

  • Access C: drive from anywhere on your PC.
  • Link with other environment variables, such as %CD% or %CommonProgramFiles%.
List Environment Variables Homedrive Windows11

8. %LogOnServer%

Every computer is connected to a a domain group or network of devices. %LogOnServer% displays the current Windows Logon server, which can be as simple as your computer name (below) or a corporate domain.

Uses

  • Quickly find out the Windows Logon server to which you’re authenticated.
  • Validate your user login to the correct Microsoft account.
List Environment Variables Logonserver Windows11

9. %Number_Of_Processors%

As the name suggests, %Number_Of_Processors% gives out the number of cores on your Windows CPU. The command returns a simple numeric value referring to the number of processor cores your device has.

Uses

  • Whether your PC has a dual (2), quad (4) or octa-core (8) processor configuration, using echo %Number_Of_Processors% is the fastest way to find out.
  • This is very useful when you want to learn whether you device will support certain games and applications that you want to run.
List Environment Variables Number Of Processors Windows11

10. %OneDrive%

The OneDrive folder contains all its essential applications, such as the Desktop, documents, and any files and folders synced with Microsoft’s Cloud servers. To open this folder, you can use its namesake environment variable, %OneDrive%.

Uses

  • Quickly access your Microsoft Cloud data from any location on your PC.
  • When using the OneDrive folder with Command Line, this variable will open the entire network path.
List Environment Variables Onedrive Folder Windows11

11. %OS%

Windows has been running its proprietary Windows NT operating system since 1993. Running an operating system-specific command like echo %OS% gives you a quick glimpse into your current operating system.

Uses

  • If you want to ensure that your current version of Windows is a valid copy (and not a pirated one), this variable gives you the confirmation.
List Environment Variables Os Winnt Windows11

12. %Path%

%Path% is one of the most common environment variables to be used on your Windows 10/11 device. When you run an echo %Path%, it gives you all the important Path files available on your PC.

Uses

  • View all your Windows Path files in one place. This includes the routine “C:WindowsSystem32” and other file locations for PowerShell, WindowsApps and OpenSSH.
  • You can utilize these Path file locations with other commands.
List Environment Variables Path Windows11 1

13. %PathExt%

While installing native and third-party apps in Windows, you come across many files with extensions, such as .COM, .EXE, .BAT (Batch files), .VBS, .VBE, and so forth. %PathExt% makes you aware of all the file extension types you need to watch out for in the %Path% variable.

Uses

  • Know all the file extensions that can be executed from Command Prompt.
  • Start a program or script in Command line without specifying the suffix, such as .EXE.
List Environment Variables Pathext Command Windows11 1

14. %Processor_Architecture%

What kind of microprocessor does your Windows device contain? With a variable echo %Processor_Architecture%, you can easily tell whether you’re using Intel or AMD (or any other CPU), and whether it’s 64 or 32-bit.

Uses

  • Knowing the exact architecture your Windows device uses is helpful when you install compatible games and applications.
List Environment Variables Processor Architecture Windows11

15. %Processor_Identifier%

The echo %Processor_Identifier% variable goes deeper into CPU-specific information, including processor family and model series, whether it’s Genuine Intel or AMD, and what level of design change a processor was built into. (It’s called processor “stepping.”)

Uses

  • Advanced applications, such as creating Windows batch scripts or testing hardware failure.
  • Testing the hardware compatibility of external components, such as motherboard, RAM etc., with your Windows device.
List Environment Variables Processor Identifier Windows11

16. %Processor_Level%

In analyzing chip architecture, echo %Processor_Level% displays the processor level showing the model number of the CPU installed in your device. It is expressed numerically as 3,4, 5 (for x86) to 6 for (x64) computers.

Uses

  • Validating that you have the right processor capabilities on your processor as advertised by the chip-maker.
List Environment Variables Processor Level Windows11

17. %Processor_Revision%

While each processor is being designed, it goes through a series of design iterations. echo %Processor_Revision% tells you the revision number of the installed CPU. In other words, it lets you know how advanced a processor is.

Uses

  • When buying a new laptop, you can use this variable to make an informed decision in choosing a chipset.
List Environment Variables Processor Revision Windows11

18. %ProgramData%

Much like Program Files, the Program Data folder is used by Windows to install standard applications but does not require higher level Administrator privileges. Using %ProgramData% gives you easy access to this folder.

Uses

  • Malware authors often try to attack the ProgramData folder, as tampering with its files can affect installed apps. Always keeping it hidden is important.
  • As an Admin user, you should stay on top of any changes in the folder. Use “System Restore” if you notice any errors.
List Environment Variables Programdata Windows11

19. %ProgramFiles%

The %ProgramFiles% and %ProgramFiles(86)% variables directly launch the respective Program Files and Program Files for 32-bit application folders. This allows you to view all your installed file components.

Uses

  • Add, edit and delete any program files directly in this section.
  • Are you unable to access the File Explorer for any reason? If so, %ProgramFiles% from the Run menu gives you quick access to this folder.
List Environment Variables Program Files Windows11

20. %Prompt%

The Prompt variable, %Prompt%, gives an indication of the current Command Prompt, validating whether your Command Prompt executable, cmd.exe is present in the correct folder path. It is written as echo %Prompt% and returns specific values as shown below.

Uses

  • The output Prompt text can be returned. It consists of various characters, where $P refers to a current drive and path, and $G means equal to or greater than. Thus, if you get an output such as $P$G, it means your cmd.exe is in the right folder.
List Environment Variables Prompt Command Windows11

21. %PSModulePath%

The Windows PowerShell script uses various modules located in different parts of a Windows PC. The %PSModulePath% variable used as echo %PSModulePath% displays all of the various locations for it, such as Program Files or System32.

Uses

  • PowerShell modules contain various components, such as Cmdlets, Providers, workflows, and aliases. These are frequently used in coding activity in sync with the main PowerShell window.
  • You can access them centrally with a %PSModulePath% variable without having to search for them individually.
List Environment Variables Psmodulepath Windows11

22. %Public%

The variable %Public% when typed in the Run menu reveals the public users folder located at C:UsersPublic. It stores all the documents, downloads, music, and pictures attached to the publicly accessible folder.

Uses

  • Getting a birds-eye view of all user accounts registered in a Windows device.
  • Sharing data with others via your computer or network.
List Environment Variables Public Command Windows11

23. %Random%

The Command Prompt has its own variable, %Random%, which is used to generate a random number between 0 to 32767. To use it, you need to type echo %Random%, which will generate a number, such as 21907 shown here.

Uses

  • Random numbers are often used in Windows batch scripts for testing purposes.
  • If you are facing issues with numeric display on your device, test whether the random numbers are displaying correctly in Command line.
List Environment Variables Randomnumber Windows11

24. %SessionName%

If you are frequently using remote desktops, it may become hard to tell whether the current session being hosted is local to the device. This problem can be addressed using echo %SessionName%.

Uses

  • If the SessionName is shown as “Console,” you know that the session is local to your device.
  • Similarly, if you see an Output such as “RDP-Tcp#,” it will inform you whether you’re using a Remote Desktop session.
List Environment Variables Sessionname Windows11

25. %SystemRoot%

The System Root of your folder, C:Windows, contains many utilities that are integral to your device performance. They can all be centrally accessed from the %SystemRoot% variable in theRun menu. Also check %WinDir%..

Uses

  • Accessing Control Panel applications as they’re directly linked to System Root folder.
  • The System Root contains utilities such as “Fonts.” You can directly open these folder paths from Run menu and operate on them using Command Prompt.
List Environment Variables Systemroot Windows11

26. %Temp%

One of the best known applications of environment variables, the temporary files folders can be accessed using %Temp% or %Tmp% in Run menu.

Uses

  • Instead of remembering the entire path “C:UsersAppDataLocalTemp,” you can simply open the temporary files folder with a simple and easy to remember command.
  • Delete as many temporary files as you want to free up space on your device and improve PC performance.
List Environment Variables Temp Folder Windows11

27. %UserDomain%

Every desktop device is marked by a user domain. To know where your current user is being hosted, you can check the domain with an environment variable called %UserDomain%. It has to run with an echo command as echo %UserDomain%.

Uses

  • Mapping the current PC user’s desktop session with its username.
  • Setting up Group user policies for several users.
List Environment Variables Userdomain Windows11

28. %UserProfile%

If there are multiple usernames registered on a Windows device, it becomes difficult to tell which user is connected to a current desktop profile. Using a Run menu variable, such as %UserProfile%, will get you a complete view.

Uses

  • Accessing and managing multiple user profiles registered on a Windows PC.
  • Deleting and editing the desktop, documents, and downloads for multiple user profiles (something only Admin users can do).
List Environment Variables Userprofiles Windows11

29. %WinDir%

The %WinDir% is similar to %SystemRoot%, in that both point to the C:Windows location on your PC. However, unlike the latter, WinDir can be used to launch standard Windows system calls to open a folder or get a specific output. It is also more commonly used in the latest Windows devices.

Uses

  • Centrally access error reports pertaining to system faults, as all of them link to the %WinDir% variable and its location C:Windows.
  • The WinDir folder is closely linked to the administrator account and 64-bit applications.
List Environment Variables Windir Windows11

30. %ZES_ENABLE_SYSMAN%

Sysman means System Resource Management library. This covers many things in Windows 11/10, such as power management of various system components. To enable this setting, you need to input echo %ZES_ENABLE_SYSMAN%.

Uses

  • If the Output value returns itself as 1, then it means that the default SysMan settings for the CPU have been initialized.
  • On some Windows devices, you can use echo %ZES_ENABLE_SYSMAN_LOW_POWER% to ensure low power settings. Thus, both Sysman commands can be used to turn the current low power settings On or Off.
List Environment Variables Zes Enable Sysman Windows11

Frequently Asked Questions

How can I resolve Windows environment variables that are not recognized?

If one or more of your Windows environment variables are not being recognized, it is possible that their settings are missing on your device. Go to “View Advanced System Settings” from the search menu and open Environment Variables, then add those missing environment variables one by one. Close the window and try resolving the issue.

How can I export and import environment variables in Windows?

To export or import environment variables in Windows, you need to open the Registry Editor from the Run menu (regedit.exe). You will find environment variables here under “HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment” and “HKEY_CURRENT_USEREnvironment.” You can export and import the new environment variables in this section’s right panel.

How do I refresh environment variables in Windows?

In the Command Prompt window, using the “cls” command will clear the screen and refresh all the environment variables for you. But to do that properly, you need to first set the variables at their respective locations. See this detailed guide on how to set variables correctly.

Image credit: Pixabay All screenshots by Sayak Boral

Sayak Boral

Sayak Boral

Sayak Boral is a technology writer with over eleven years of experience working in different industries including semiconductors, IoT, enterprise IT, telecommunications OSS/BSS, and network security. He has been writing for MakeTechEasier on a wide range of technical topics including Windows, Android, Internet, Hardware Guides, Browsers, Software Tools, and Product Reviews.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Понравилась статья? Поделить с друзьями:
  • How to change windows user password
  • How to change windows to linux
  • How to change windows language settings
  • How to change windows language in windows 7 professional
  • How to change windows language from russian to english