title: Windows CMD: How to pipe running program output to FINDSTR and write to file
body: <p><em>I am trying to filter the output of a running program (ping) and write the results to a file.</em></p>
  
  <p>In the following example the ping program runs until CTRL-C is pressed:</p>
  
  <pre><code>ping www.google.com -t | findstr "Reply" &gt;&gt; file.txt
  </code></pre>
  
  <p>the result of this is the creation of 'file.txt' however, the contents are <strong>empty</strong>.</p>
  
  <p>On the other hand, the following code, <em>without</em> piping to findstr works when interrupted with CTRL-C</p>
  
  <pre><code>ping www.google.com -t &gt;&gt; file.txt
  </code></pre>
  
  <p>What am I missing here?</p>