Windows Powershell ForEach-Object 循环
对管道对象逐个处理
如果使用Get-WmiObject获取系统中的服务,为了排版可能会也会使用Format-Table对结果进行表格排版。
PSC:Powershell>Get-WmiObjectWin32_Service|Format-Tablestatus,DisplayName -AutoSize
statusDisplayName ----------------- OK AdobeAcrobatUpdateService OK ApplicationExperience OK ApplicationLayerGatewayService OK ApplicationHostHelperService OK ApplicationIdentity OK ApplicationInformation OK ApplicationManagement OK ASP.NETStateService