A logo showing the text blog.marcnuri.com
Español
Home»Operations»Windows: How to list all environment variables

Recent Posts

  • Fabric8 Kubernetes Client 7.2 is now available!
  • Connecting to an MCP Server from JavaScript using AI SDK
  • Connecting to an MCP Server from JavaScript using LangChain.js
  • The Future of Developer Tools: Adapting to Machine-Based Developers
  • Connecting to a Model Context Protocol (MCP) Server from Java using LangChain4j

Categories

  • Artificial Intelligence
  • Front-end
  • Go
  • Industry and business
  • Java
  • JavaScript
  • Legacy
  • Operations
  • Personal
  • Pet projects
  • Tools

Archives

  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • August 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • February 2020
  • January 2020
  • December 2019
  • October 2019
  • September 2019
  • July 2019
  • March 2019
  • November 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • December 2017
  • July 2017
  • January 2017
  • December 2015
  • November 2015
  • December 2014
  • March 2014
  • February 2011
  • November 2008
  • June 2008
  • May 2008
  • April 2008
  • January 2008
  • November 2007
  • September 2007
  • August 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2007
  • March 2007

Windows: How to list all environment variables

2008-04-30 in Operations tagged Windows / PowerShell by Marc Nuri | Last updated: 2023-10-29
Versión en Español

Introduction

Knowing the environment variables in your platform is a must when you are developing or administrating a system. In this post, I will show you the possible ways to list all environment variables in Windows.

  • From cmd
  • From PowerShell
  • From the Windows Graphical User Interface (GUI)

How to list all environment variables from cmd

Open a new command prompt (Win+R, then type cmd and hit enter) and type:

cmd.exe
set

The command outputs a list of all the environment variable names and values separated by an equal sign (=).

A screenshot showing the output of the set command
A screenshot showing the output of the set command

You can also filter the output by typing:

cmd.exe
set | findstr "PATH"

The command now outputs the same list but only shows the environment variables that contain the word PATH.

A screenshot showing the output of the set|findstr command
A screenshot showing the output of the set|findstr command

How to list all environment variables from PowerShell

PowerShell is the new command line interface for Windows. It is much more powerful than the old cmd.exe.

PowerShell offers multiple ways to list all environment variables. The easiest one is to use the Get-ChildItem cmdlet.

Using Get-ChildItem

Open a new PowerShell prompt (Win+R, then type powershell and hit enter) and type:

Windows PowerShell
Get-ChildItem Env:

The command outputs a list of all the environment variable names and values in a table format.

A screenshot showing the output of the PowerShell Get-ChildItem Env: command
A screenshot showing the output of the PowerShell Get-ChildItem Env: command

Using one of the Get-ChildItem aliases

Typing Get-ChildItem is a bit long, so PowerShell offers some aliases to make it easier to use. You can use any of the following commands to get the same result:

  • gci Env:
  • dir Env:
  • ls Env:
Windows PowerShell
ls Env:

The command outputs the same as the Get-ChildItem Env: command.

A screenshot showing the output of the PowerShell ls Env: command
A screenshot showing the output of the PowerShell ls Env: command

The main advantage of the PowerShell approach is that you can provide many options to the cmdlet to customize its output for your needs.

Note

PowerShell is shipped with most of the modern Windows Versions.

If you are running Microsoft Windows XP, you can set it up by installing MS .NET Framework 2.0 SP2 for Win2000 SP4, XP SP2/SP3 & Server 2003 SP2, and then Microsoft Windows PowerShell 1.0 for Windows XP.

How to check environment variables from the Windows Graphical User Interface (GUI)

If you don't need to use this output in a script, or you just prefer to use the Windows GUI, you can check the environment variables from the System Properties window.

Press the Win+R keys, type sysdm.cpl and hit enter.

A screenshot of the Windows Run dialog
A screenshot of the Windows Run dialog

Next, click on the Advanced tab and then on the Environment Variables button.

A screenshot of the Windows System Properties dialog
A screenshot of the Windows System Properties dialog

The Environment Variables dialog will open. You can see the list of all environment variables for the current user and the system.

A screenshot of the Windows Environment Variables dialog
A screenshot of the Windows Environment Variables dialog

Conclusion

In this post, I have shown you the possible ways to list all environment variables in Windows. From the command line using cmd.exe or the new PowerShell, to the plain old Windows GUI. I hope you find it useful.

Twitter iconFacebook iconLinkedIn iconPinterest iconEmail icon

Post navigation
Windows: How to kill a process from the command lineHow to install Apache Maven on Windows?
© 2007 - 2025 Marc Nuri