Format-Table behavior in PowerShell 5

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 5 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #38071
    Profile photo of Tim Curwick
    Tim Curwick
    Participant

    In PowerShell 4 and below, absent the -Autoformat switch, Format-Table spreads out the columns across the console, with guesses about appropriate column widths based on just the first object in the pipeline.

    In PowerShell 5, Format-Table without the -Autoformat switch uses -Autoformat -like formatting based on however many objects it get from the pipeline in the first 300 milliseconds.

    With the -Autoformat switch, Format-Table waits until it has all of the items from the pipeline before making decisions on column widths.

    Most of the time, the default PowerShell 5 behavior or the -Autoformat behavior works great. But on rare occasions, neither produces readable results, and the default PowerShell 4 behavior would be preferable.

    Is there a way in PowerShell 5 to force Format-Table to behave like it did in PowerShell 4?

    #38072
    Profile photo of Don Jones
    Don Jones
    Keymaster

    It's coded into the formatting system. Although you could obviously create custom views for your objects, which would become their default views rather than the generic behavior.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.