title: Start multiple tasks in parallel and wait for them in windows?
body: <p>How do I execute some tasks in parallel in batch script and wait for them?</p>
  
  <pre><code>command1;
  
  # command3, command4 and command5 should execute in sequence say task1
  # command6, command7 and command8 should execute in sequence say task2
  # both task1 and task2 should run independently
  
  command3; command4; command5 | command6; command7; command8;
  
  # should execute only after the above parallel tasks are completed
  
  command9;
  </code></pre>
  
  <p>As a proof of concept I tried something like but it is not working:</p>
  
  <pre><code>echo "Starting"
  start /wait wait20.bat   
  start /wait wait40.bat 
  echo "Finishing"
  </code></pre>
  
  <p><code>wait20.bat</code> looks like:</p>
  
  <pre><code>echo "starting 20 seconds job"
  timeout 20
  echo "finishing 20 seconds job"
  </code></pre>
  
  <p>What am I doing wrong?</p>