title: Powershell Switch Statement to Set Multiple Variables
body: <p>I am in the process of converting some old VB script to Powershell. I am trying to use a Switch statement to set multiple variables. Is this possible in Powershell? In VBS my code would look something like this:</p>
  
  <pre><code>Select Case ENV
      Case "DEV"
          : SRCDRV  = "\\Server1" _
          : DESTDRV = "\\Server1\Folder1\"
  
      Case "TEST"
          : SRCDRV  = "F:" _
          : DESTDRV = "\\Server1\Folder2\"
  
      Case "PROD"
          : SRCDRV  = "F:" _
          : DESTDRV = "\\Server2\Folder2\"
  End Select
  </code></pre>
  
  <p>I have tried something similar in PS, but it doesn't seem to set the variables. </p>
  
  <pre><code>switch ($cENV) {
      DEV { 
          $SRCDRV = "\\Server1"
          $DSTDRV = "\\Server2\Folder1\"
          break     
      }
      TEST {
          $SRCDRV = "\\Server1"
          $DSTDRV = "\\Server2\Folder2\"
          break
       }
      PROD {
          $SRCDRV = "\\Server1"
          $DSTDRV = "\\Server2\Folder2\"
          break
       }
  }
  </code></pre>
  
  <p>When I check the value of either DESTDRV or SRCDRV I get an error saying: The variable '$SRCDRV' cannot be retrieved because it has not been set. Any ideas on what I'm doing wrong?</p>