34,333
edits
Changes
→Wildcards, Regular Expressions and Case Sensitivity in switch Statements
This is a good point to raise the issue of case sensitivity in Windows PowerShell switch statements. The important point to note is that, unless otherwise specified, switch statements are ''case insensitive''. To make a switch statement ''case sensitive'' the ''-casesensitive'' statement must be used:
<pre>
switch -casesensitive ("RedLine")
{
'RedLine' { "RedLine matches" }
}
</pre>
Clearly, with a case sensitive match, only one of the switch cases will result in a match (''RedLine'').