Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

up vote 3 down vote accepted

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\
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.