title: I need to call .bat file from Powershell script
body: <p>We are migrating perl script to powershell script.
  In Perl the code is as shown below</p>
  
  <pre><code>$rc='D:\\EmailConnector\\run.bat&gt; $EmailConnector_log;';
  </code></pre>
  
  <p>I tried as shown below but not working</p>
  
  <pre><code>StartProcess "cmd.exe" "/c D:\EmailConnector\run.bat&gt; $EmailConnector_log"
  </code></pre>
  
  <p>When I tried as shown below the .bat script ran, but I want to update the log file. Could you help me on this.</p>
  
  <pre><code>StartProcess run.bat -workingdirectory "D:\EmailConnector"
  </code></pre>
  
  <p>The .bat file consist of jar file for email functionality. But we want to get log in log file.</p>