我如何在PowerShell的“格式桌”

问题描述 投票:0回答:1

当我使用“格式表”显示使用[pscustomobject]创建的数据时,如果列中的数据是从命令点的输出中提取的值,则在其列的右侧显示。但是,如果我手动设置了一个值,则显示在其列的左侧。

使用“ netapp.ontap”模块:

$volSis = Get-NcSis -Name 'MyVolume' $object = [pscustomobject]@{ 'Compression' = $volSis.IsCompressionEnabled #This resolves to 'True' or 'False' 'Dedupe' = 'Foo' } $object | Format-Table
输出是:

Compression Dedupe ----------- ------ True Foo
有什么方法可以强制表格(或右)合理的表中的所有列?另外,是否可以将手动创建的数据(即本示例中的“ foo”)进行正确进行?

powershell formatting powershell-5.1
1个回答
0
投票
您可以将

-Property

与设置为
Alignment
用于
Left
属性:
bool
不幸的是,您还需要列出要显示的其余属性。
    

© www.soinside.com 2019 - 2024. All rights reserved.