0

When I run a PowerShell cmdlet, often an output line is wider than will fit in the PS window. In this case, the output terminates with ... and the balance of the line is not displayed. Is there any way of seeing this output? I see this specifically in PowerShell V6 on Windows 10. For example, I run the cmdlet Get-ChildItem Env: and several of the lines output by the cmdlet are too long to fit on the screen.

9
  • 1
    A screenshot will help here Commented Oct 18, 2019 at 20:55
  • Do you use Format-Table or similiar and use -AutoSize? Commented Oct 18, 2019 at 20:59
  • What version of PSReadLine are you running? If you use the beta release a good bit of things like this are fixed. Commented Oct 18, 2019 at 21:45
  • @ShawnMelton I am using PowerShell Version 6. Do you mean that I need to get the latest version from GitHub? Commented Oct 18, 2019 at 23:10
  • @Alex_P Do you have to use Format-Table to be able to read screen output from an arbitrary cmdlet? I only want to be able to read the output physically. Commented Oct 18, 2019 at 23:14

2 Answers 2

2

The correct way of handling this problem is:

Get-ChildItem -Path Env: | Format-Table -Property Name, Value -Wrap

The point I missed because of my poor knolwedge of PowerShell was that it was necessary to format the output before printing, thus bypassing the default formatting provided by PowerShell.

Sign up to request clarification or add additional context in comments.

Comments

1

If you have a single line of text you may be able resolve it by piping it to

| out-string -Width 160

(Of course, you might have to play with the 160 to get it right)

If you have a collection of items, and it's only showing the first 3, you probably want to set

$FormatEnumerationLimit=-1

-1 here is for no limit- you could set it to any number. Lastly, you have a table your creating and the columns aren't wide enough, try

| Format-Table -AutoSize

2 Comments

I have several lines of output from a cmdlet and some lines are too long to fit the screen. So far as I know, I am not using tables.
The scope of FormatEnumerationLimit is unintuitive, but this article explains how to make it work within a script devblogs.microsoft.com/powershell-community/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.