Windows Powershell Where-Object 条件过滤
过滤管道结果
使用Get-Process返回所有的当前进程,但是你可能并不对所有的进程感兴趣,然后通过每个Process对象的属性进行过滤。首先得知道每个对象支持那些属性。
PSC:Powershell>Get-Process|select-First1|fl*
__NounName :Process Name :AcroRd32 Handles :287 VM :234819584 WS :32616448 PM :63488000 NPM :14584 Path :C:ProgramFilesAdobeReader10.0ReaderAcroRd32 .exe Company :AdobeSystemsIncorporated CPU :96.5334188 FileVersion :10.1.2.45 ProductVersion :10.1.2.45 Description :AdobeReader Product :AdobeReader Id :4820 PriorityClass :Normal HandleCount :287 WorkingSet :32616448 PagedMemorySize :63488000 PrivateMemorySize :63488000 VirtualMemorySize :234819584 TotalProcessorTime :00:01:36.5334188 BasePriority :8 ExitCode : HasExited :False ExitTime : Handle :3568 MachineName :. MainWindowHandle :198686 MainWindowTitle :MasteringPowerShell-AdobeReader MainModule :System.Diagnostics.ProcessModule(AcroRd32.exe) MaxWorkingSet :1413120 MinWorkingSet :204800 Modules :{System.Diagnostics.ProcessModule(AcroRd32.exe), System.Diagnostics.ProcessModule(ntdll.dll),Syst em.Diagnostics.ProcessModule(kernel32.dll),Syste m.Diagnostics.ProcessModule(KERNELBASE.dll)...} NonpagedSystemMemorySize :14584 NonpagedSystemMemorySize64:14584 PagedMemorySize64 :63488000 PagedSystemMemorySize :302460 PagedSystemMemorySize64 :302460 PeakPagedMemorySize :75399168 PeakPagedMemorySize64 :75399168 PeakWorkingSet :87871488 PeakWorkingSet64 :87871488 PeakVirtualMemorySize :257703936 PeakVirtualMemorySize64 :257703936 PriorityBoostEnabled :True PrivateMemorySize64 :63488000 PrivilegedProcessorTime :00:00:27.7057776 ProcessName :AcroRd32 ProcessorAffinity :3 Responding :True SessionId :1 StartInfo :System.Diagnostics.ProcessStartInfo StartTime :2012/1/1310:25:34 SynchronizingObject : Threads :{4376,6636,8096,5136...} UserProcessorTime :00:01:08.8276412 VirtualMemorySize64 :234819584 EnableRaisingEvents :False StandardInput : StandardOutput : StandardError : WorkingSet64 :32616448 Site : Container :