PowerTip: Use Filter Parameter with Get-ChildItem in PowerShell

Doctor Scripto

Summary: Use the –Filter parameter with the Get-ChildItem Windows PowerShell cmdlet.

Hey, Scripting Guy! Question Why can't I get the –Filter parameter to work with the Get-ChildItem cmdlet?

Hey, Scripting Guy! Answer Try using the FileSystem provider. The –Filter parameter will accept two wildcard characters ( ? and )
           and a single string as a filter (not an array of strings like the –Include parameter uses). Here is an example
           of using –Filter to look for document files:

Get-ChildItem E:\Data -filter "*doc*"

0 comments

Discussion is closed.

Feedback usabilla icon