title: Option Menu in Powershell: Continue After Loop
body: <p>I would like to create a simple menu in powershell. If you look at my example bellow, I am waiting in do loop until the key 'q' is pressed. If user hits '1' or '2', it should do something specified in switch, leave the loop and continue in script by showing "Another part of code". </p>
  
  <p>If break is used in switch, it doesn't leave the loop. If return is is used, the entire script is exited.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>function Select-Machine
  {
  cls
  
       Write-Host "1: Option1"
       Write-Host "2: Option2"
       Write-Host
  }
  
  Do{
       Select-Machine
       $input = Read-Host "Choose Virtual Machine"
       switch ($input)
       {
             '1' {
                  #1: Do Something
                  break
                 } 
  
             '2' {
                  #2: Do Something
                  break
                 } 
        }
       }until($input -eq 'q')
  
  Write-Host "Another part of code"
  </code></pre>