title: windows command line output pipe or redirection in real time and publish to mqtt broker
body: <p>Is it possible to <strong>read</strong> a continuously running windows command output and publish to <strong>mqtt</strong> broker <strong>continuously</strong> under <strong>windows7/8/2012</strong> OS?</p>
  
  <p>(No 3rd party software, I am using windows command prompt, not powershell)</p>
  
  <p>windows command:</p>
  
  <pre><code>ping -t www.google.com
  </code></pre>
  
  <p>mqtt publish</p>
  
  <pre><code>mosquitto_pub -h iot.eclipse.org -t MyTopic/pingstatus -m "Ping Console Output Goes Here"
  </code></pre>
  
  <p>My idea format (not exist as year 2015...)</p>
  
  <pre><code>ping -t www.google.com | assign output to %%variable | mosquitto_pub -h iot.eclipse.org -t MyTopic/pingstatus -m %%variable
  </code></pre>
  
  <p>DO NOT give me <code>for loop</code> solution, it will publish to the broker only after the 1st command finished the process.</p>
  
  <p>I want <code>command_1.exe | command_2.exe</code> run <strong>continuously / in real time</strong>. </p>
  
  <p>That means the <code>command_1</code> is still running while <code>command_2</code> publish mqtt messages one by one.</p>