背景:
阅读新闻

Format-Table on Array of Hash Tables

  作者: 今日评论: [字体: ]

from > https://stackoverflow.com/questions/20874464/format-table-on-array-of-hash-tables

Using Powershell V4:

$table = @( @{ColumnA="Able";    ColumnB=1},
            @{ColumnA="Baker";   ColumnB=2},
            @{ColumnA="Charlie"; ColumnB=3} )

$table | ForEach {[PSCustomObject]$_} | Format-Table -AutoSize


ColumnA ColumnB
------- -------
Able          1
Baker         2
Charlie       3

V2 solution:
 $(foreach ($ht in $table)
 {new-object PSObject -Property $ht}) | Format-Table -AutoSize

来源:
录入日期:[2021/08/01 20:50:00]
收藏 推荐 打印 | 录入:mikebai | 阅读:
文章评论      
正在加载评论列表...
评论关闭