How to See Environment Variables in Windows
In this article
To see the names and values of environment variables in Windows, open Command Prompt or PowerShell, type set and press Enter. That prints every variable and its current value. For a single variable, use echo %VARIABLE_NAME% (Command Prompt) or $env:VARIABLE_NAME (PowerShell). You can also view and edit them graphically in the System Properties window, but the command line is fastest for just reading.
What You'll Need
- A Windows PC (any recent version: Windows 10, 11, or Windows Server).
- Permission to open Command Prompt or PowerShell (a standard user account is fine for viewing).
- No additional software—everything is built into Windows.
Step-by-Step
Method 1: Using Command Prompt (Quickest)
- Press Windows Key + R to open the Run dialog.
- Type
cmdand press Enter. This opens Command Prompt. - Type
setand press Enter. A list of all environment variables and their values appears. The format isNAME=value. - To see a specific variable, type
echo %PATH%(replacePATHwith the variable name) and press Enter. The value is printed on the next line.
Method 2: Using PowerShell
- Right-click the Start button and select Windows PowerShell or Terminal.
- Type
Get-ChildItem Env:and press Enter. This lists all variables and values in a table format. - To see one variable, type
$env:PATH(replacePATHwith the variable name) and press Enter.
Method 3: Using the Graphical Interface (GUI)
- Press Windows Key + R, type
sysdm.cpl, and press Enter. This opens System Properties. - Go to the Advanced tab and click Environment Variables… at the bottom.
- A dialog opens with two sections: (top) and System variables (bottom). Each shows variable names and values.
- To see the full value of a variable, select it and click Edit. The value appears in a text field. Click Cancel to close without making changes.
Note: Menu labels may differ slightly depending on your Windows version and language, but the general paths are the same.
Common Mistakes
- Typing the variable name wrong—environment variables are case-insensitive in Windows, but the exact spelling matters. For example,
%Path%works, but%Pth%does not. - Using
echoin PowerShell—echo %PATH%works in Command Prompt but not in PowerShell. In PowerShell, use$env:PATH. - Forgetting the percent signs in Command Prompt—
echo PATHprints the literal word “PATH”, not the value. You need%PATH%. - Confusing user and system variables—the GUI shows two separate lists. A variable can exist in both, and the user value overrides the system one for that user.
- Closing the Command Prompt before reading—the list can be long, so scroll up or use
set | moreto page through.
Tips
- To see only variables that start with a certain letter, use
set Pin Command Prompt—it filters to variables whose names begin with “P”. - In PowerShell, you can sort the list alphabetically with
Get-ChildItem Env: | Sort-Object Name. - To copy the entire list to a text file, run
set > env.txtin Command Prompt. The file is created in the current directory. - If you need to see the value of a variable inside a batch script, use
echo %VARIABLE%just like in the command line. - For a quick look at a single variable in the GUI, you can also search for “environment variables” in the Start menu and click “Edit the system environment variables”.
Troubleshooting
If you don’t see the variables you expect, or the command returns nothing:
- Check that you’re using the right command—
setworks in Command Prompt, but in PowerShell you must useGet-ChildItem Env:orls Env:. - If
echo %VAR%prints the literal text (e.g.,%VAR%instead of a value), the variable doesn’t exist. Verify the spelling and whether it’s a user or system variable. - If the GUI shows a variable but the command line doesn’t, you may have opened the command prompt before the variable was set. Close and reopen the terminal after changing variables—environment variables are read at launch.
- If you get “Access is denied” when trying to view system variables in the GUI, you may need administrator rights. Right-click the app and select “Run as administrator”.
- If the list is too long to read, use
set | more(Command Prompt) orGet-ChildItem Env: | Format-Table -AutoSize(PowerShell) to see it in pages or a table.
Frequently Asked Questions
How do I see the PATH variable specifically?
In Command Prompt, type echo %PATH%. In PowerShell, type $env:PATH. The value is a semicolon-separated list of directories.
What’s the difference between user and system environment variables?
System variables apply to all users and are set by Windows or by software installed for everyone. User variables apply only to your account. If a variable exists in both, the user value takes precedence for your sessions.
Can I see environment variables without opening a command prompt?
Yes—use the GUI method: open System Properties (sysdm.cpl), go to the Advanced tab, and click Environment Variables. You’ll see both lists there.
Why does my PATH variable look different in the GUI vs. the command line?
In the GUI, the PATH variable is shown as a single string with semicolons. In the command line, it’s the same. However, the GUI’s “Edit” dialog splits it into multiple lines for easier reading—that’s just a display difference.
How do I see environment variables for another user?
You can’t easily view another user’s variables without logging into that account or using administrative tools. The GUI only shows your own user variables and the system variables. For system variables, you need administrator access.
Are environment variables case-sensitive?
No, Windows treats variable names as case-insensitive. %Path% and %PATH% refer to the same variable. However, the values themselves are case-sensitive.