title: Checking host reachability on windows command line
body: <p>How can I check in batch-file if host is reachable or not? The problem is that <code>ping</code> returns 0 not only on success, but also on <code>Destination host unreachable</code> error:</p>
  
  <pre><code>C:\&gt;ping 192.168.1.1 -n 1
  
  Pinging 192.168.1.1 with 32 bytes of data:
  Reply from 192.168.1.1: bytes=32 time=3ms TTL=64
  
  Ping statistics for 192.168.1.1:
      Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
  Approximate round trip times in milli-seconds:
      Minimum = 3ms, Maximum = 3ms, Average = 3ms
  
  C:\&gt;echo %errorlevel%
  0
  
  C:\&gt;ping 192.168.1.105 -n 1
  
  Pinging 192.168.1.105 with 32 bytes of data:
  Reply from 192.168.1.102: Destination host unreachable.
  
  Ping statistics for 192.168.1.105:
      Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
  
  C:\&gt;echo %errorlevel%
  0
  </code></pre>
  
  <p>Is there any way to do it with <code>ping</code> or any other build-in-Windows tool? I would prefer not to install anything if that's possible...</p>