【发布时间】:2015-05-20 23:27:45
【问题描述】:
我想将 Format-Table -Autosize 与 pscustomobject 一起使用。
我想要相当于:
Get-Process | ft Id,ProcessName -AutoSize
我试过了(虽然输出位于中心)
Get-Process | %{
[pscustomobject]@{
ID = $_.Id
ProcessName = $_.ProcessName
}
}
它可以工作,但是当我使用 Format-Table -Autosize 它不起作用时,它会添加带有新行的新标题。
Get-Process | %{
[pscustomobject]@{
ID = $_.Id
ProcessName = $_.ProcessName
} | Format-Table -AutoSize
}
如何解决这个问题?
【问题讨论】:
标签: powershell