title: DOS redirecting output not working
body: <p>I have a Windows program that I call inside a .BAT file like this:</p>
  
  <pre><code>.\my_prog.exe param1
  </code></pre>
  
  <p>If I just call it like that, from a cmd or powershell window I get some output. However, if I redirect the output to some file, it does not work. If I write:</p>
  
  <pre><code>.\my_prog.exe param1 &gt;out.txt 2&gt;&amp;1
  </code></pre>
  
  <p><code>out.txt</code> is empty after execution of my script is over.</p>
  
  <p><code>my_prog.exe</code> is a proprietary binary and I don't have access to the code.</p>
  
  <p>It is worth mentionning that I have a linux version of the same script that calls a binary compiled for linux. I had the same issue, but I managed to work around it by using the script command:</p>
  
  <pre><code>script -c "./my_prog.lx param1"
  </code></pre>
  
  <p>I can't find an equivalent of "script" and cygwin is not an option unfortunately.</p>
  
  <p>Thanks for your help</p>
  
  <p>EDIT:</p>
  
  <p>After digging up more, I found out that my program does not flush the buffer when the output is written to another source than STDOUT. Now, my best shot at this is to trick my program into thinking that it is writing to STDOUT, is there a way of doing that in BAT or wurh powershell ?</p>
  
  <p>Thanks</p>