下面的查询将列出 power shell 中的 cmdlet。
get-command -CommandType cmdlet | Group-Object -Property verb
Run Code Online (Sandbox Code Playgroud)
因为我需要按降序对列数进行排序,然后按升序命名列。下面的查询没有给出预期的结果。
get-command -CommandType cmdlet | Group-Object -Property verb | Sort-Object Count, name -Descending
get-command -CommandType cmdlet | Group-Object -Property verb | Sort-Object Count -Descending | Sort-Object name
get-command -CommandType cmdlet | Group-Object -Property verb | Sort-Object Count -Descending, name
Run Code Online (Sandbox Code Playgroud)
请在 PS 中使用单个查询帮助我解决这个问题
您可以通过提供带有Descending
项目的哈希表来覆盖单个属性的顺序:
Get-Command -CommandType cmdlet |Group-Object Verb |Sort-Object Count,@{Expression='Name';Descending=$false} -Descending
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
898 次 |
最近记录: |