This write-up will provide different methods for listing all Windows environment variables. So, let’s get started!
How to List all Environment Variables in Windows?
To list all Windows environment variables, you can use:
We will now discuss each of the mentioned methods one by one.
Method 1: List all Environment Variables in Windows Using Command Prompt
The “set” command can be used in Command Prompt to list all Windows environment variables. To list all environment variables using Command Prompt, follow the below-given examples.
Step 1: Open Command Prompt
First, press “Window+R”, type “cmd” in the “Open” drop-down menu, and press the “OK” button to open Command Prompt:
Step 2: Use “set” Command to List Environment Variables
Utilize the “set” command on Command Prompt to list down all of the environment variables:
You can also redirect “>” and save the list of environment variables in a text file:
The below-given output indicates that we have successfully stored all environment variables in the “env_Output.txt” file:
Let’s check out how to list all environment variables on Windows using PowerShell.
Method 2: List all Environment Variables in Windows Using PowerShell
To list all Windows environment variables, you can use the “Get-ChildItem” or “dir” command on PowerShell. Follow the procedure to check out how to use these commands on Windows PowerShell.
Step 1: Open PowerShell
First, search for the “Windows PowerShell” in the “Startup” menu and open PowerShell as an administrator:
Step 2: Use “Get-ChildItem” to List Environment Variables
To list down all the environment variables on Windows PowerShell, utilize the “Get-ChildItem” with “Env:” for environment variables as mentioned in below-provided command:
Step 3: Use “dir” to List Environment Variables
To display all environment variables in the form of a list, utilize the “dir” command on Windows PowerShell with “Env:”:
Let’s check out the method to view all environment variables using the Registry Editor.
Method 3: List all Environment Variables in Windows Using Registry Editor
To list all environment variables in Windows using Registry Editor, follow up on the below-provided procedure.
Step 1: Windows Registry
Press “Window+R”, type “regedit” in the “Open” drop-down menu, and click on the “OK” button to open Registry Editor:
Step 2: List Environment Variables
Expand the “HKEY_CURRENT_USER” registry folder as it contains the Environment variables of the current user:
Double click on the “Environment” to list all environment variables of the current user in Windows:
To view the System environment variables in Registry, copy the given path and paste it into the “Address” bar:
We have demonstrated the techniques to list all environment variables in Windows.
Conclusion
To list all Windows environment variables, you can use Command Prompt, PowerShell, or Registry Editor. In Windows, utilize the “set” command to list Windows environment variables. In PowerShell, run the “Get-ChildItem” or “dir” command. In the Registry Editor, the “User Variables” are stored in the “HKEY_CURRENT_USER” key, while “System Variables” are stored in the “HKEY_LOCAL_MACHINE” key. We have compiled the different solutions to list all environment variables on Windows.