title: Race condition in PowerShell
body: <p>I need to play all videos in a playlist so I came up with this code.</p>
  
  <pre><code>Foreach ($line in get-content playlist) 
  { $line | invoke-item  }
  </code></pre>
  
  <p>Which should go through the file and play each line using the default player.</p>
  
  <p>The problem that it creates a race condition, the processes will start and end so fast that one can only see the last file.</p>
  
  <p>How to overcome this, I tried /path/to/player $line | out-null but the player will stop and needs user intervention in order to proceed.</p>