title: PowerShell: break nested loops
body: <p>There should be a <code>break</code> command in PowerShell that can exit nested loops by assigning a label. Just it doesn't work. Here's my code:</p>
  
  <pre><code>$timestampServers = @(
      "http://timestamp.verisign.com/scripts/timstamp.dll",
      "http://timestamp.comodoca.com/authenticode",
      "http://timestamp.globalsign.com/scripts/timstamp.dll",
      "http://www.startssl.com/timestamp"
  )
  
  :outer for ($retry = 2; $retry -gt 0; $retry--)
  {
      Write-Host retry $retry
      foreach ($timestampServer in $timestampServers)
      {
          Write-Host timestampServer $timestampServer
          &amp; $signtoolBin sign /f $keyFile /p "$password" /t $timestampServer $file
          if ($?)
          {
              Write-Host OK
              break :outer
          }
      }
  }
  if ($retry -eq 0)
  {
      WaitError "Digitally signing failed"
      exit 1
  }
  </code></pre>
  
  <p>It prints the following:</p>
  
  <pre><code>retry 2
  timestampServer http://timestamp.verisign.com/scripts/timstamp.dll
  Done Adding Additional Store
  Successfully signed and timestamped: C:\myfile.dll
  OK
  retry 1
  timestampServer http://timestamp.verisign.com/scripts/timstamp.dll
  Done Adding Additional Store
  Successfully signed and timestamped: C:\myfile.dll
  OK
  
  ERROR: Digitally signing failed
  </code></pre>
  
  <p>What have I done wrong?</p>
  
  <p>Can I have goto and labels, please?</p>
  
  <p>Using Windows 7 and I guess PS 2.0. This script is supposed to run on PS 2 at least.</p>