Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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).

share|improve this question
up vote 8 down vote accepted

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

gci env: | Format-Table -Wrap -AutoSize


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


share|improve this answer
This is already very good. Any way of getting the same format as a standard cmd prompt? Perhaps invoking cmd.exe from the PowerShell prompt? – sancho.s Dec 18 '13 at 17:56
Good, that's what I was proposing. – sancho.s Dec 18 '13 at 18:02

If you want to emulate set output from powershell without invoking cmd try:

dir env: | %{"{0}={1}" -f $_.Name,$_.Value}

a lot of typing, so wrap it in a function:

function set {dir env: | %{"{0}={1}" -f $_.Name,$_.Value}}
share|improve this answer
Both options work ok. – sancho.s Dec 20 '13 at 14:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .