a question powershell output formatting

Welcome Forums General PowerShell Q&A a question powershell output formatting

This topic contains 4 replies, has 2 voices, and was last updated by

 
Participant
4 years, 4 months ago.

  • Author
    Posts
  • #19369

    Participant
    Points: 1
    Rank: Member

    I understand that you can format output by using -autosize -wrap, fl, ft and various other methods. However I'm a little confused about formatting columns so I can see all the output. When I run gv PSVersionTable | ft -wrap the output it still cutoff with a ...
    I know I can run $psversiontable, but I want to know why gv Error | ft -wrap wraps the text properly but gv PSVersionTable | ft -wrap does not.

  • #19372

    Keymaster
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    It depends on the object. Some object types have pre-defined formatting instructions provided by Microsoft, and their formatting will reflect that default unless you do something completely custom – e.g., define each output column yourself.

  • #19390

    Participant
    Points: 1
    Rank: Member

    define each output column yourself.

    and how would you to that.

  • #19414

    Keymaster
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero
    Get-Something | Format-Table ColumnA,ColumnB,@{n='ColumnC';expression={ $_.PropC / 1GB };width=10;align='right';formatString='N2'}

    As an example. There are other examples in the help for Format-Table. The point is, when you list out the columns yourself – whether you create custom ones or not, as I've done with ColumnC in my example – the default formatting doesn't apply.

  • #19421

    Participant
    Points: 1
    Rank: Member

    capisce.

The topic ‘a question powershell output formatting’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort