Changes

Jump to: navigation, search

The Windows PowerShell 1.0 switch Statement

13 bytes added, 19:07, 3 December 2008
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'').

Navigation menu