title: Execute batch file in Powershell
body: <p>I want to execute the following from a batch file:</p>
  
  <pre><code>"C:\OpenCover\tools\OpenCover.Console.exe" -register:user -target:"%VS110COMNTOOLS%..\IDE\mstest.exe" -targetargs:"/testcontainer:\"C:\Develop\bin\Debug\MyUnitTests.dll\" ... "
  PAUSE
  </code></pre>
  
  <p>Now I would like to log the output of the process to a file for which I came across the quite handy powershell usage of</p>
  
  <pre><code>powershell "dir | tee output.log"
  </code></pre>
  
  <p>but this does not take my batch file as first argument (<code>powershell "my.bat | tee output.log"</code>) because it is not the name of a cmdlet or a function or a script file.</p>
  
  <p>I could change my batch file so that is says <code>powershell "OpenCover.Console.exe..."</code> but I would have to adapt all quotes and change escape characters and so forth.</p>
  
  <p>Is there a way to make a batch file execute in powershell? Or is there a way to drop in my line unchanged from the batch after some powershell command and it all executes "like it ought to"?</p>