title: Capture output of a batch file in powershell script
body: <p>I need to capture the output created by a .bat file that is run from within a .ps1 file.</p>
  
  <p>I'm new to powershell scripting but I know this isn't correct syntax. This best illustrates what I need to have happen. </p>
  
  <p>I need to execute the facter.bat script then store its output in <code>$Body</code> so I can use that text later.</p>
  
  <pre><code> "C:\Program Files (x86)\Puppet Labs\Puppet\bin\facter.bat" &gt; $Body
  </code></pre>