I’ve been playing with PowerShell’s operators a lot this week… one thing I’m sure you’ve noticed is that operators like -eq, -match, and -like are all case-insensitive. By default, PowerShell is pretty insensitive throughout the shell, which means you can be a bit lazy. “Don” is the same as “don” is the same as “DON” and so forth.
But there are times when you might want PowerShell to be a bit more sensitive. And in those cases, there are always the case-sensitive operators:
- -ceq
- -cne
- -cle
- -cge
- -cgt
- -clt
- -cmatch
- -cnotmatch
- -clike
And so forth… run help about_operator* for more details and the complete. And, if you want to make it clear in a script or one-liner that you don’t care about case, you can use the explicit case insensitive operators: -ieq, -imatch, -inotmatch, -ilike, and their friends. Sadly, there is no -ipod operator, although perhaps we’ll see a -zune operator in PowerShell v2.
So go forth and make PowerShell as sensitive as you like.