Powershell查询的升序和降序

Powershell查询的升序和降序,powershell,Powershell,下面的查询将列出power shell中的cmdlet get-command -CommandType cmdlet | Group-Object -Property verb 在这种情况下,我需要按降序对列计数排序,然后按升序命名列。以下查询未给出预期结果 get-command -CommandType cmdlet | Group-Object -Property verb | Sort-Object Count, name -Descending get-command -Comma

下面的查询将列出power shell中的cmdlet

get-command -CommandType cmdlet | Group-Object -Property verb
在这种情况下,我需要按降序对列计数排序,然后按升序命名列。以下查询未给出预期结果

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

请在PS中的单个查询中帮助我,您可以通过提供带有降序项的哈希表来覆盖单个属性的顺序:

Get-Command -CommandType cmdlet |Group-Object Verb |Sort-Object Count,@{Expression='Name';Descending=$false} -Descending

我不确定我是否遵循了你的逻辑。你怎么能同时按两个不同的属性对任何东西进行适当的排序呢?@Mosheperez?首先按第一个属性排序,然后根据第一个属性对每个具有相同排序顺序的项目按第二个属性排序,以此类推。