title: How do I output Ping Success or Failure in one command, rather than two?
body: <p>Here is a snippet of my current code (which works):</p>
  
  <pre><code>PING &lt;ip-address&gt; |find "TTL="&gt;nul &amp;&amp; ECHO Responsive&gt; &lt;filename&gt;
  PING &lt;ip-address&gt; |find "TTL="&gt;nul || ECHO Unresponsive&gt; &lt;filename&gt;
  </code></pre>
  
  <p>In doing a bit of <a href="http://ss64.com/nt/ping.html" rel="nofollow">research</a> I've found that checking <code>ERRORLEVEL</code> can give incorrect results at times, so I chose to use the above method for logging the success or failure of <code>PING</code>. I also think it looks a bit cleaner.</p>
  
  <p><strong>The problem</strong> I have with it is that in the case where the ip address is not pingable, the command gets called twice and each ping command takes a while to complete. Also, in the (worst case) scenario where a computer is about to become un-pingable during the first command, it's possible that I'll get both results in my log file. So I'm wondering how to write these two lines as one ping command?</p>