gpt4 book ai didi

powershell - Format-List的-view参数是什么?

转载 作者:行者123 更新时间:2023-12-03 13:42:38 25 4
gpt4 key购买 nike

Format-List 显然有一个名为“view”的字符串参数,可以看出here .它是做什么的,它是如何工作的?除了“替代格式或‘ View ’的名称”之外,我找不到任何文档。

最佳答案

各种 Format-* cmdlet 上的“-View”参数允许您获得各种不同的“ View ”或数据格式,例如:

PS> Get-Process

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
672 56 272684 220692 975 141.45 8480 powershell
692 34 47184 60156 234 23.73 17048 powershell
751 82 217624 162780 1047 157.73 13336 powershell_ise

对比

PS> Get-Process | Format-Table -View StartTime


StartTime.ToShortDateString(): 1/14/2013

ProcessName Id HandleCount WorkingSet
----------- -- ----------- ----------
powershell 8480 672 225988608


StartTime.ToShortDateString(): 2/6/2013

ProcessName Id HandleCount WorkingSet
----------- -- ----------- ----------
powershell 17048 624 92418048


StartTime.ToShortDateString(): 1/17/2013

ProcessName Id HandleCount WorkingSet
----------- -- ----------- ----------
powershell_ise 13336 771 166686720

至于确定哪些命令支持替代 View ,您通常可以在文档中找到此类信息。以下是 Get-Process 帮助的摘录:

You can also use the built-in alternate views of the processes available with Format-Table, such as "StartTime" and "Priority", and you can design your own views. For more information, see T:Microsoft.PowerShell.Commands.Format-Table.

PowerShell Community Extensions还包括一个名为 Get-ViewDefinition 的命令,它可以在文档不可用时获取此信息(或在这方面有很大帮助。

关于powershell - Format-List的-view参数是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14741397/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com