10
4
From a Windows 7 machine, I ping an IP address of a turned-off machine.
C:\>ping 192.168.1.222
Pinging 192.168.1.222 with 32 bytes of data:
Reply from 192.168.1.222: Destination host unreachable.
Reply from 192.168.1.222: Destination host unreachable.
Reply from 192.168.1.222: Destination host unreachable.
Ping statistics for 192.168.1.222:
Packets: Sent = 3, Received = 3, Lost = 0 (0% loss)
Even though there is no reply, the errorlevel is set to 0
.
What I am trying to do, is figure out if a remote machine is replying to ping. One of my tests is to turn off the machine and ping it. For some reason, ping sets errorlevel to 0
.
Can anyone confirm that this is valid for all use cases? – user1853181 – 2015-01-09T14:11:22.793
2I tested setting the
-w
switch to 2999 against a valid and invalid IP adding the-n 1
switch as well. It seems to work. – fyrye – 2015-01-22T22:41:47.410yes... this sets the errorlevel if no host at the specified address... thanks – ZEE – 2017-05-02T20:19:11.350