The * wildcard will match zero or more characters
The ? wildcard will match a single character
[m-n] Match a range of characters from m to n, so [f-m]ake will match fake/jake/make
[abc] Match a set of characters a,b,c.., so [fm]ake will match fake/make
Powershell wildcards are consistent in their meaning so using *.* will match any characters followed by a period (.) followed by any characters. In other words *.* will return only files that have an extension, not directories. To return all items just use a single *
This is quite different to the behaviour seen under the CMD shell.
When using WMI filters use the WMI specific wildcards: % for zero or more characters, _ for a single character.
PS C:\>Get-ChildItem c:\work\*.xls
PS C:\>Get-ChildItem c:\work\[a-f]*.txt
“We usually see only the things we are looking for, so much that we sometimes see them where they are not” ~ Eric Hoffer
Comparison operators -like, -lt, -gt, -eq, -ne, -match
© Copyright SS64.com 1999-2013
Some rights reserved