Mastodon
//Ris Adams;

Display all environment variables with powershell

Cover image for Display all environment variables with powershell.

When configuring a development environment, you can use the PowerShell command to display all environment variables. This can be useful for gathering information about the environment, or for debugging.

(Get-ChildItem env:*).GetEnumerator() | Sort-Object Name | Out-String

Tips-and-Tricks

If you wish you can all adjust the script above to send the output to a filterable grid window.

(Get-ChildItem env:*).GetEnumerator() | Sort-Object Name | Out-GridView

Or you can send it directly to the clipboard to be pasted into a file.

(Get-ChildItem env:*).GetEnumerator() | Sort-Object Name | clip

Of course, you need to have PowerShell installed on your machine. On Windows, when possible, I recommend installing PowerShell from the Microsoft Store; This will be easier to manage and keep up to date.

On Linux, you can install PowerShell from the official repositories Specific instructions are available here: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell

§