PowerShell: Env: Avoid truncation of environment variables

Solution 1:

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\

Solution 2:

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