PowerShellSwitch statement


Introduction

A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case. It enables you to write a script that can choose from a series of options, but without requiring you to write a long series of if statements.

Remarks

This topic is documenting the switch statement used for branching the flow of the script. Do not confuse it with switch parameters which are used in functions as boolean flags.