2013-09-25 36 views
0

我試圖過濾掉一些簡單的服務對象上的垃圾,但-notlike會變長,我嘗試過但不能得到它的工作,但是有沒有辦法刪除重複的-notlike成一個例如-notlike '軟件選裝*', 'APPLIC *', '這*', '那*'Powershell中的清潔/多重-notlike

Where-Object { $_.StartMode -eq 'Auto' -and $_.State -ne 'Running' -and $_.Displayname -notlike '*.NET*' -and $_.Displayname -notlike 'Softw*'-and $_.Displayname -notlike 'Applic*'} 

回答

1

你可以使用-notmatch:

$_.Displayname -notmatch "(\.NET|Softw|Applic)" 
+0

你確定你的正則表達式嗎? –

+0

@ C.B。 - 我剛剛更新了它。 – Lee

+0

簡單,當你知道如何,謝謝:) –