Powershell: Autosize and Specific Column Width

前端 未结 3 1544
没有蜡笔的小新
没有蜡笔的小新 2020-12-20 02:18

Based on this SO question Powershell: Output collection of objects, I am able to wrap a collection of strings in multiple lines in one column. However, when I try to output

3条回答
  •  借酒劲吻你
    2020-12-20 02:53

    Here is an example

    F:\> $array|format-table RecordType,
    $array|Format-Table @{Label= "RecordType";Expression={ $_.RecordType};             Width = 10 }, `
                    @{Label= "Date"      ;Expression={ $_.date};                   Width = 8 },`
                    @{Label= "Time"      ;Expression={ $_.Time};                   Width = 8 },`
                    @{Label= "code"      ;Expression={ $_.code}},`
                    @{Label = "sales"    ;Expression={ [math]::Round($_.sales,2)} }
    

提交回复
热议问题