Select ... Case

Conditionally execute a block of statements.

      Select Case TestExpression
         [Case ExpressionList
         [Case Else
      End Select

   TestExpression  A numeric or String expression which will
                   determine which block of code is executed

   ExpressionList  Comma delimited list of expressions to compare/
                   match against TestExpression

   Statements-n    Statements to execute if a match is found.

   ElseStatements  Statements to execute if a match is not found.



select case strPerson
case "Alex" WScript.Echo "We found Alex"
case "Jasper" WScript.Echo "We found Jasper"
case "Helen" WScript.Echo "We found Helen"
end select

“The day soldiers stop bringing you their problems is the day you have stopped leading them. They have either lost confidence that you can help them or concluded that you do not care. Either case is a failure of leadership” ~ Colin Powell


If..Then - Conditionally execute a block of statements
While...Wend - Conditionally repeat a block of statements
Equivalent in PowerShell: Switch - Multiple if statements

© Copyright 1999-2015
Some rights reserved