Windows: List Environment Variables – CMD & PowerShell

What is an environment variable in Windows? An environment variable is a dynamic “object” containing an editable value which may be used by one or more software programs in Windows.

In this note i am showing how to list environment variables and display their values from the Windows command-line prompt and from the PowerShell.

Cool Tip: Add a directory to Windows %PATH% environment variable! Read More →

List Windows Environment Variables

The environment variables in Windows can be printed using the Windows command-line prompt (CMD) or using the PowerShell.

Windows Command-Line Prompt (CMD)

List all Windows environment variables and their values:

C:\> set

“Echo” the contents of a particular environment variable:


Windows PowerShell

Print all Windows environment variables (names and values):

PS C:\> gci env:* | sort-object name

Show the contents of a particular environment variable:


Cool Tip: Set environment variables in Windows! Read More →

3 Replies to “Windows: List Environment Variables – CMD & PowerShell”

  1. says: Reply

    very helpful. helped me in debugging system environment variables

  2. For PowerShell, you can cut it down a fair amount to an easy to remember 7 character command:

    gci env:

  3. kurt krueckeberg says: Reply

    Very helpful! thanks.

Leave a Reply