根据company过滤所有产品发布者以”Microsoft”打头的进程: 复制代码 代码如下: PS C:Powershell> Get-Process | Where-Object {$_.company -like "*Microsoft*" }| select Name,Description,Company msseces Microsoft Security Clie... Microsoft Corporation notepad 记事本 Microsoft Corporation ONENOTEM Microsoft OneNote Quick... Microsoft Corporation OUTLOOK Microsoft Outlook Microsoft Corporation powershell Windows PowerShell Microsoft Corporation prevhost Preview Handler Surroga... Microsoft Corporation RDCMan RDCMan Microsoft Corporation SearchProtocolHost Microsoft Windows Searc... Microsoft Corporation taskhost Windows 任务的主机进程 Microsoft Corporation
使用别名 因为Where-Object的使用概率比较高,所以有一个很形象的别名 ? 可以使用: 复制代码 代码如下: PS C:Powershell> Get-Service | ? {$_.Name -like "B*"} Status Name DisplayName ------ ---- ----------- Running BDESVC BitLocker Drive Encryption Service Running BFE Base Filtering Engine Running BITS Background Intelligent Transfer Ser... Stopped Browser Computer Browser Stopped bthserv Bluetooth Support Service