PS C:Powershell> ls | Sort-Object Length Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 2011/11/28 15:30 63 ping.bat -a--- 2011/12/2 18:47 140 test.ps1 -a--- 2011/11/28 16:42 170 test.vbs -a--- 2011/11/28 11:12 186 LogoTestConfig.xml -a--- 2011/11/23 17:37 242 test.txt -a--- 2011/11/25 11:20 556 employee.xml
PS C:Powershell> ls | Sort-Object Length -Descending Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 2011/11/24 17:44 735892 Powershell_Cmdlets.html -a--- 2011/11/24 18:30 67580 a.html -a--- 2011/11/24 20:04 26384 a.txt -a--- 2011/11/29 19:23 21466 function.ps1 -a--- 2011/11/24 20:26 12060 alias -a--- 2011/11/24 17:37 7420 name.html
PS C:Powershell> Dir | Sort-Object Length, Name -descending, -ascending Sort-Object : 找不到接受实际参数“System.Object[]”的位置形式参数。 所在位置 行:1 字符: 18 + Dir | Sort-Object <<<< Length, Name -descending, -ascending + CategoryInfo : InvalidArgument: (:) [Sort-Object], ParameterBin dingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell .Commands.SortObjectCommand
PS C:Powershell> Dir | Sort-Object @{expression="Length";Descending=$true},@{ex
pression="Name";Ascending=$true}
目录: C:Powershell
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2011/11/24 17:44 735892 Powershell_Cmdlets.html
-a--- 2011/11/24 18:30 67580 a.html
-a--- 2011/11/24 20:04 26384 a.txt
-a--- 2011/11/29 19:23 21466 function.ps1
-a--- 2011/11/24 20:26 12060 alias
-a--- 2011/11/24 17:37 7420 name.html
-a--- 2011/12/14 11:22 3460 ls.html
-a--- 2011/11/30 16:04 2556 psdrive.html
-a--- 2011/11/25 11:20 556 employee.xml
-a--- 2011/11/23 17:37 242 test.txt
-a--- 2011/11/28 11:12 186 LogoTestConfig.xml
-a--- 2011/11/28 16:42 170 test.vbs
-a--- 2011/12/2 18:47 140 test.ps1
PS C:Powershell> Get-Service | Group-Object Status
Count Name Group
----- ---- -----
87 Running {System.ServiceProcess.ServiceController, System.ServiceProcess.S
erviceController, System.ServiceProcess.ServiceController, System
.ServiceProcess.ServiceController...}
88 Stopped {System.ServiceProcess.ServiceController, System.ServiceProcess.S
erviceController, System.ServiceProcess.ServiceController, System
.ServiceProcess.ServiceController...}
PS C:Powershell> ls | Group-Object Extension
Count Name Group
----- ---- -----
2 {ABC, alias}
5 .html {a.html, ls.html, name.html, Powershell_Cmdlets.html...}
2 .txt {a.txt, test.txt}
2 .xml {employee.xml, LogoTestConfig.xml}
2 .ps1 {function.ps1, test.ps1}
1 .bat {ping.bat}
1 .vbs {test.vbs}
PS C:Powershell> ls | Group-Object {$_.Length -gt 1kb}
Count Name Group
----- ---- -----
7 False {ABC, employee.xml, LogoTestConfig.xml, ping...
8 True {a.html, a.txt, alias, function.ps1...}
PS C:Powershell> ls | Group-Object {$_.name.SubString(0,1).toUpper()}
Count Name Group
----- ---- -----
3 A {a.html, a.txt, alias}
1 E {employee.xml}
1 F {function.ps1}
2 L {LogoTestConfig.xml, ls.html}
1 N {name.html}
3 P {ping.bat, Powershell_Cmdlets.html, psdrive.html}
3 T {test.ps1, test.txt, test.vbs}
PS C:Powershell> Get-Process | Group-Object Company -NoElement Count Name ----- ---- 2 Adobe Systems Incorpor... 52 2 微软 22 Microsoft Corporation 1 Adobe Systems, Inc. 1 Microsoft (R) Corporation 1 1 NVIDIA Corporation
PS C:Powershell> Dir | Sort-Object Extension, Name | Format-Table -groupBy Extension 目录: C:Powershell Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 2011/11/24 20:26 12060 alias 目录: C:Powershell Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 2011/11/28 15:30 63 ping.bat 目录: C:Powershell Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 2011/11/24 18:30 67580 a.html -a--- 2011/12/14 11:22 3460 ls.html -a--- 2011/11/24 17:37 7420 name.html -a--- 2011/11/24 17:44 735892 Powershell_Cmdlets.html -a--- 2011/11/30 16:04 2556 psdrive.html
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有