Shorter version:

gci env:* | sort-object name

This will display both the name and value.

Answer from jaymjarri on Stack Overflow
Discussions

How to print all environment variables by scope? e.g. Process, Machine and User
You can get them the same way you set them [System.Environment]::GetEnvironmentVariables([System.EnvironmentVariableTarget]::Machine) [System.Environment]::GetEnvironmentVariables([System.EnvironmentVariableTarget]::User) [System.Environment]::GetEnvironmentVariables([System.EnvironmentVariableTarget]::Process) More on reddit.com
🌐 r/PowerShell
16
4
March 28, 2019
Please help me understand the purpose of environments in PowerShell
Powershell has no "Environments". If they " look similar to variables", you're most likely talking about environment variables. They are not related to Powershell, they are part of the environment the OS provides to process. They provide information to the processes. Partly they are maintained by the OS itself, partly they are user maintained to configure and control processes. More on reddit.com
🌐 r/PowerShell
42
11
December 25, 2023
env and environment variables in Powershell
$env is a powershell object just like $true. If you want to set an environment variable there's 2 normal ways to do it, one using $env, the second using [Environment]::SetEnvironmentVariable Using $env will only set the variable for the current powershell process, whereas using [Environment]::SetEnvironmentVariable you can set it for different areas (process, user, or machine). When you do $INCLUDE you're not setting an environment variable, you're just creating a variable called $INCLUDE. see http://technet.microsoft.com/en-us/library/ff730964.aspx More on reddit.com
🌐 r/PowerShell
5
8
December 7, 2014
Environment Variable inside a single '
There are a lot of different ways to do this, I like PowerShell's flexibility when dealing with strings. Single quotes do indeed turn everything literal. however, single quotes are literal inside of double quotes msiexec wont care if the path is encased in single or double quotes so you could use single quotes in your string -ArgumentList "/I '$env:temp\My MSI File.msi' /qn" You could also escape the double quote with a back tick -ArgumentList "/I `"$env:temp\My MSI File.msi`" /qn" Unrelated to your post but helpful when dealing with strings. If you are trying to access a property in an object that is a string it can be formatted like this "This is the users first name $($user.firstname)" More on reddit.com
🌐 r/PowerShell
6
14
November 10, 2021
🌐
Netwrix
netwrix.com › en › resources › blog › powershell-environment-variables
PowerShell Environment Variables
August 25, 2025 - For instance, the PATH variable, ... straightforward methods to list all environment variables is by using the Get-ChildItem cmdlet with the “Env:” drive....
🌐
Marc Nuri
blog.marcnuri.com › home › windows: how to list all environment variables
Windows: How to list all environment variables - Marc Nuri
October 29, 2023 - 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
🌐
Codecademy
codecademy.com › docs › powershell › environment variables
PowerShell | Environment Variables | Codecademy
May 16, 2023 - Jump into PowerShell through interactive lessons on variables, operators, control flow, objects, arrays, and functions. ... Running the Get-ChildItem cmdlet on the Env: drive lists all the environment variables defined in the current environment.
🌐
PowerShell Test-Path
powershellfaqs.com › list-all-environment-variables-in-powershell
How to List All Environment Variables in PowerShell?
November 20, 2024 - PS C:\> Get-ChildItem Env: | Where-Object { $_.Name -eq 'PATH' } Name Value ---- ----- PATH C:\Windows\system32;C:\Windows;C:\Program Files\Git\cmd;C:\Program Files\nodejs · In addition to listing environment variables, PowerShell allows you to create, modify, and remove them.
Find elsewhere
🌐
SharePoint Diary
sharepointdiary.com › sharepoint diary › powershell › how to get environment variables in powershell?
How to Get Environment Variables in PowerShell? - SharePoint Diary
September 20, 2025 - User scope applies to your account and persists across sessions without admin rights. Machine scope is system-wide for all users but needs admin privileges. Check scopes when listing with [Environment]::GetEnvironmentVariables("Machine") for machine-level ones. Are environment variables case-sensitive in PowerShell? On Windows, no.
🌐
ShellGeek
shellgeek.com › home › powershell › powershell print environment variables
PowerShell Print Environment Variables - ShellGeek
April 14, 2024 - The above Get-ChildItem Env: command in PowerShell, print all environment variables. Sort cmdlet takes the output of the Get-ChildItem command and sorts the list of PowerShell environment variables by the variable name.
🌐
O'Reilly
oreilly.com › library › view › professional-windows-r-powershell › 9780471946939 › 9780471946939_exploring_environment_variables.html
Exploring Environment Variables - Professional Windows® PowerShell [Book]
April 23, 2007 - To see a complete list of environment variables, use this command from any location: get-childitem env:* To sort the environment variables alphabetically and then page the output, use this command: get-childitem env:* | sort-object Key | more ·
Author   Andrew Watt
Published   2007
Pages   551
🌐
SS64
ss64.com › ps › syntax-env.html
Windows Environment variables in PowerShell
$windows_path = $env:Path $windows_path -split ';' PSModulePath lists all the paths that PowerShell searches for modules and includes in its module auto-loading: ... You can also change environment variables with Set-Item, Remove-Item, and Copy-Item.
🌐
TheITBros
theitbros.com › windows › powershell › managing environment variables in windows with powershell – theitbros
Managing Environment Variables in Windows with PowerShell – TheITBros
January 7, 2026 - Process scope – such environment variables are only available within the current process (PowerShell session). You can list them using the command: Get-Variable
🌐
TutorialsPoint
tutorialspoint.com › article › how-to-get-environment-variable-value-using-powershell
How to get environment variable value using PowerShell?
October 31, 2023 - Environment variables in PowerShell are stored as PS drive (Env: ). To retrieve all the environment variables stored in the OS you can use the below command. ... Name Value ---- ----- ALLUSERSPROFILE C:\ProgramData APPDATA C:\Users\delta\Ap...
🌐
Argon Systems
argonsys.com › home › msft articles › powertip: use windows powershell to display all environment variables
PowerTip: Use Windows PowerShell to display all Environment variables - Argon Systems
August 11, 2024 - Summary: Doctor Scripto demonstrates how to use [System.Environment] to show all currently set environment variables Question: Hey Doctor Scripto, I remember in DOS if I wanted to see the values of all the Environment variables; like TEMP I could just type the SET Command.
🌐
Medium
kevinlinxc.medium.com › viewing-and-setting-environment-variables-in-every-shell-4df43127bd8
Viewing and Setting Environment Variables in Every Shell | by Kevin Lin | Medium
September 11, 2023 - # list all environment variables set # fetch a specific environment variable echo %VariableName% # pretty print the PATH variable (one path per line) for %A in ("%PATH:;=" "%") do @echo %~A # set an environment variable for the current session set VariableName=Value # delete an environment variable for the current session set VariableName=
🌐
GitHub
github.com › fleschutz › PowerShell › blob › main › scripts › list-environment-variables.ps1
PowerShell/scripts/list-environment-variables.ps1 at main · fleschutz/PowerShell
Lists all environment variables · .DESCRIPTION · This PowerShell script lists all environment variables. .EXAMPLE · PS> ./list-environment-variables.ps1 · · Name Value · ---- ----- ALLUSERSPROFILE C:\ProgramData ·
Author   fleschutz
🌐
Michael Smith
mikesmith.us › home › technology › operating system › windows › windows 10 › comprehensive list of environment variables in windows 10/11
Comprehensive List of Environment Variables in Windows 10/11 - Michael Smith
October 3, 2022 - After launching Windows PowerShell, type in the command: Get-ChildItem Env:. This will display the list of Environment Variables. To sort the list you can use the command: Get-ChildItem Env: | Sort Name.
🌐
Opensource.com
opensource.com › article › 19 › 9 › environment-variables-powershell
Environment variables in PowerShell | Opensource.com
September 4, 2019 - You can view all environment variables set on your system with the Get-ChildItem command from within the Env: drive. The list is long, so pipe the output through out-host -paging to make it easy to read: PS> Get-ChildItem | out-host -paging ...
🌐
LazyAdmin
lazyadmin.nl › home › how to set an environment variable in powershell
How to Set an Environment Variable in PowerShell — LazyAdmin
February 1, 2024 - The process scope contains the variables from the current process (or PowerShell session). It will also list all variables from the user and machine scopes. Custom variables added to the process scope will be lost when the session is closed. So to set environment variables that remain available ...