ls variable:* should work, or Get-Variable. If these are resulting in bad output, it's due to a poorly-implemented host, not with powershell itself. If you open the standard console host (run powershell.exe), you will see that these work fine.

If you need to work around a bad host, you might have better luck dumping everything to explicit strings:

Get-Variable | Out-String

or

Get-Variable |%{ "Name : {0}`r`nValue: {1}`r`n" -f $_.Name,$_.Value }
Answer from latkin on Stack Overflow
Discussions

List the variables and their values in a script (ISE)

Run "Get-Variable" as you open up the ISE and save the result to a variable, then when you want to check new variables you can run it again, but exclude the values you originally had.

$DefaultVariables=Get-Variable

Get-Variable -Exclude ($DefaultVariables.Name + "DefaultVariables")
More on reddit.com
🌐 r/PowerShell
8
4
February 3, 2019
Echo equivalent in PowerShell for script testing - Stack Overflow
I would like to output variables and values out in a PowerShell script by setting up flags and seeing the data matriculate throughout the script. How would I do this? For example, what would b... More on stackoverflow.com
🌐 stackoverflow.com
Format-List | output variable
Get rid of | Format-List, it destroys your object and its sole purpose is for human eyeball consumption from the console. More on reddit.com
🌐 r/PowerShell
14
10
July 26, 2019
How to keep output all in one line?
Cause you're concatenating your strings, "sometime $user has a location of $location" Format it how you want it output More on reddit.com
🌐 r/PowerShell
4
0
March 30, 2022
🌐
4sysops
4sysops.com › home › blog › articles › display and search all variables of a powershell script with get-variable
Display and search all variables of a PowerShell script with Get-Variable – 4sysops
July 28, 2023 - Today, I will show you how you can use the Get-Variable cmdlet to debug your PowerShell scripts. ... Whenever a script is not doing what it is supposed to do, you’ll want to know the values of your variables.
🌐
Microsoft Learn
learn.microsoft.com › en-us › powershell › module › microsoft.powershell.utility › get-variable
Get-Variable (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Learn
The Get-Variable cmdlet gets the PowerShell variables in the current console. You can retrieve just the values of the variables by specifying the ValueOnly parameter, and you can filter the variables returned by name.
Find elsewhere
🌐
The Lonely Administrator
jdhitsolutions.com › powershell › get my variables
Get My Variables • The Lonely Administrator
March 2, 2011 - Name Value ---- ----- a 4 b 2 c 8 VERBOSE: Finished getting my variables 8 [/cc] The function works by launching a separate PowerShell console session without any profiles to capture all variables. This should be all the variables defined by PowerShell.
🌐
Netwrix
netwrix.com › en › resources › blog › powershell-environment-variables
PowerShell Environment Variables
August 25, 2025 - There are two primary methods to accomplish this: using the “$Env:<variable-name>” syntax or employing the “Get-ChildItem” cmdlet along with the variable name. For example, if you want to access the USERNAME variable, you will use the ...
🌐
Netwrix
blog.netwrix.com › 2018 › 10 › 04 › powershell-variables-and-arrays
How to Use PowerShell Variables
August 26, 2025 - You can list all current variables in a PowerShell session by using the Get-Variable cmdlet, which retrieves all variables in the current scope.
🌐
ShellGeek
shellgeek.com › home › powershell › powershell get variables
PowerShell Get Variables - ShellGeek
April 14, 2024 - In this article, we will discuss how to use the Get-Variable cmdlet to get variables in PowerShell and list all variables created in the current scope.
🌐
Delft Stack
delftstack.com › home › howto › powershell › print environment variables in powershell
How to Print Environment Variables in Windows PowerShell | Delft Stack
February 12, 2024 - By executing Get-ChildItem Env:, we are presented with a comprehensive list, including each variable’s name and value. ... The flexibility of PowerShell allows us to combine Get-ChildItem with other commands using piping.
🌐
PDQ
pdq.com › powershell › get-variable
Get-Variable - PowerShell Command | PDQ
The Get-Variable cmdlet gets the Windows PowerShell variables in the current console. You can retrieve just the values of the variables by specifying the ValueOnly parameter, and you can filter the variables returned by name. ... Specifies an array of items that this cmdlet excludes from the operation. Wildcards are permitted. ... Specifies an array of items upon which the cmdlet will act, excluding all others.
🌐
Microsoft Learn
learn.microsoft.com › en-us › powershell › module › microsoft.powershell.utility › write-output
Write-Output (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Learn
Writes the specified objects to the pipeline. If Write-Output is the last command in the pipeline, the objects are displayed in the console. Write-Output sends objects to the primary pipeline, also known as the success stream.
🌐
ShellGeek
shellgeek.com › home › powershell › powershell print environment variables
PowerShell Print Environment Variables - ShellGeek
April 14, 2024 - Cool Tip: How to set environment ... environment variables with their name and values sorted by name field, and using the Export-CSV command, it prints all environment variables to the file specified by the Path paramet...
🌐
ITPro Today
itprotoday.com › home › powershell
PowerShell Basics: Variables
June 4, 2024 - PowerShell provides the Variable: drive, which lets you access the variables in your PowerShell session. The Variable: drive is just like a file system drive (e.g., C), except you're accessing variables instead of file system items. For example, this command lists all variables in your current session:
🌐
EITCA Academy
eitca.org › home › how can you output the value stored in a variable in powershell?
How can you output the value stored in a variable in PowerShell? - EITCA Academy
August 5, 2023 - To output the value stored in a variable in PowerShell, you can use the Write-Output cmdlet or simply type the name of the variable. PowerShell is a powerful scripting language and command-line shell that is widely used in Windows Server administration and cybersecurity tasks.
🌐
Windows Report
windowsreport.com › windows 11 › how to › how to print environment variables in powershell: 4 easy tips
How to Print Environment Variables in Powershell: 4 Easy Tips
October 16, 2025 - Copy and paste the following line and press Enter: gci env: | sort-object name| Export-Csv -Path D:\env_variables.txt -NoTypeInformation · Then use the Export-Csv command line to print all environment variables to the file.
🌐
EDUCBA
educba.com › home › data science › data science tutorials › powershell tutorial › powershell print
PowerShell print | Different Ways of Printing Output in PowerShell
March 6, 2023 - Write-Host "Demo of write host cmdlet" -ForegroundColor Green $test= Get-Process Write-Host "Printing a variable" -ForegroundColor Green Write-Output $test Write-Host "Passing output to another cmdlet through pipeline" -ForegroundColor Green Write-Output "sample output" | Get-Member Write-Host "Example of enumerate and no enumerate" -ForegroundColor Green Write-Output 10,20,30 | Measure-Object Write-Output 10,20,30 -NoEnumerate | Measure-Object
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
PowerShell Test-Path
powershellfaqs.com › powershell-print-variable
PowerShell Print Variable [With Examples]
February 14, 2025 - To print a variable in PowerShell, you can use the Write-Output cmdlet, which sends the specified objects down the pipeline to the next command or displays them in the console if it’s the last command. For example, if you have a variable $city containing the value “New York,” you can print ...