title: PowerShell: Start-Process with wait option taking long time to return
body: <p>I have the following script:</p>
  
  <pre><code>$mArgs = @('myProj.vcxproj', '/t:Clean,Build' ,('/p:configuration=DEBUG'+';platform=win32;OutDir=./'))
  Start-Process msbuild.exe -ArgumentList $mArgs -RedirectStandardOutput $tempFile -wait
  </code></pre>
  
  <p>The above successfully builds myProj. However, it takes a really long time to return. When the above line is reached, I see the msbuild windows for about 2 minutes. Then, it closes. After that, it takes another 8 minutes for the process to complete. If I just run the above in a cmd window, it takes about 2 minutes for it to complete. 
  I tried starting the process cmd.exe and passing msbuild as a parameter, but got the same result. 
  I also tried Invoke-Expression and also got the same results.</p>
  
  <p>Does anyone have a clue what can be causing this delay ? </p>
  
  <p>Thanks in advance!</p>