PowerShell: Env: Avoid truncation of environment variables

environment-variablespowershell

PowerShell displays environment variables, one line for each. If a variable has a long enough value, it is truncated, and appended an ellipsis:

> gci env:

Name                           Value
----                           -----
<suppressed lines>
PSModulePath                   C:\Windows\system32\WindowsPowerSh...
<suppressed lines>

Is there any way of obtaining full values for all vars at once, as in a standard cmd prompt?
(the answers given for Powershell get-childitem env:path returns ellipsed one line, how to have something useful? would not apply, then).

Best Answer

Default formatting truncates, specify -Wrap and see full output.

gci env: | Format-Table -Wrap -AutoSize

Result

PSModulePath            C:\Users\KNUCKLE-DRAGGER\Documents\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\

or if you prefer the output to exactly simulate cmd.exe, try

cmd /c start /b set

Result

PSModulePath=C:\Users\KNUCKLE-DRAGGER\Documents\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
Related Question