title: Redirected output file remains open after devenv.exe returns
body: <p>I have a .bat file with the following two commands:</p>
  
  <pre><code>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\..\IDE\devenv" plugin\proj1-vs15.sln /rebuild "Release" /project plugin\proj1-vs15.vcxproj /projectconfig "Release|x64"  1&gt;vcbuild.log 2&gt;&amp;1
  
  "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\..\IDE\devenv" plugin\proj2-vs15.sln /rebuild "Release" /project plugin\proj2-vs15.vcxproj /projectconfig "Release|x64"  1&gt;vcbuild.log 2&gt;&amp;1
  </code></pre>
  
  <p>The first command completes successfully but the second one immediately fails with the message "The process cannot access the file because it is being used by another process."</p>
  
  <p>If I use a different filename for the redirected output in the second command then both commands complete without error.</p>
  
  <p>I haven't had this problem with Visual Studio 2015 or any earlier versions, only with VS 2017.</p>
  
  <p>Why is the redirected output file remaining open after the first devenv command has completed?</p>
  
  <p>In my actual use-case having each execution of devenv.exe use a different filename for the redirected output would be inconvenient. Is there some way of ensuring that the output file is closed before the .bat file advances to the next command?</p>