title: VBScript output shell.run to log file
body: <p>I know there are a few answers to this already but I am unsure why the answers are not working. I will list what I have done.</p>
  
  <p>Basically I want to log information from a <code>shell.Run</code> command into a log file.</p>
  
  <p>What I have</p>
  
  
  
  <pre class="lang-vb prettyprint-override"><code>Dim WshShell
  Dim WshProcEnv
  
  Set WshShell =  CreateObject("WScript.Shell")
  
  WshShell.Run """C:\Program Files\Folder\batchFile.bat""", 1, TRUE 
  </code></pre>
  
  <p>Which successfully runs the batch file. </p>
  
  <p>So looking at answers like <a href="https://social.technet.microsoft.com/Forums/scriptcenter/en-US/207a390b-bc56-4a43-b54f-d32dd170d9f0/piping-to-a-log-file-in-vbscript?forum=ITCG" rel="nofollow noreferrer">this one</a> I have tried the following:</p>
  
  <pre class="lang-vb prettyprint-override"><code>WshShell.Run "cmd /c C:\Program Files\Folder\batchFile.bat &gt; C:\Program Files\Folder\log.txt", 1, TRUE
  
  WshShell.Run "cmd /c ""C:\Program Files\Folder\batchFile.bat &gt; C:\Program Files\Folder\log.txt""", 1, TRUE
  
  WshShell.Run """cmd.exe /c ""C:\Program Files\Folder\batchFile.bat &gt; C:\Program Files\Folder\log.txt""", 1, TRUE
  </code></pre>
  
  <p>I believe it's something small hence why I've asked a new question.</p>