Ping Response From Windows 7

agarwaldvk

New member
Local time
1:02 AM
Messages
10
Hi Everybody


My wired home network has4 PC's - one running Windows 7 Professional 64 bit and the other running Windows XP SP 3 32 bit O/S.

When I use the Ping command on any of the PC's running XP, the response is in the form as below from a PC which is offline :-

Pinging 192.168.X.XXX with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.X.XXX:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),



The response is in the form as below from a PC which is online :-

Pinging 192.168.X.XXX with 32 bytes of data:
Reply from 192.168.X.XXX: bytes=32 time<1ms TTL=128
Reply from 192.168.X.XXX: bytes=32 time<1ms TTL=128
Reply from 192.168.X.XXX: bytes=32 time<1ms TTL=128
Reply from 192.168.X.XXX: bytes=32 time<1ms TTL=128

Ping statistics for 192.168.X.XXX:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Please take note of the % loss - 0% and 100% in cases on online and offline computers.


However, when I execute the Ping command from my PC running Windows 7, the response takes the following form :-


For a onine PC :-
Pinging 192.168.X.XXX with 32 bytes of data:
Reply from 192.168.X.XXX: bytes=32 time<1ms TTL=128
Reply from 192.168.X.XXX: bytes=32 time<1ms TTL=128
Reply from 192.168.X.XXX: bytes=32 time<1ms TTL=128
Reply from 192.168.X.XXX: bytes=32 time<1ms TTL=128

Ping statistics for 192.168.X.XXX:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms


For a offine PC :-
Pinging 192.168.X.XXX with 32 bytes of data:
Reply from 192.168.Y.YYY: Destination host unreachable.
Reply from 192.168.Y.YYY: Destination host unreachable.
Reply from 192.168.Y.YYY: Destination host unreachable.
Reply from 192.168.Y.YYY: Destination host unreachable.

Ping statistics for 192.168.X.XXX:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),


Again, please take note of the % loss - 0% and 0% in both cases that is for both the online and offline computers. Also, note that the response is from the computer that the Ping command is executed from - in this case the one with Y.YYY. The Pinged computed is X.XXX.


Is it possible that I can get the Ping command response from this computer running Windows 7 as 100% (Loss) for an offline computer as I get in the case of Ping command response executed from a computer running Windows XP?


PS. If this helps, I am using this loss % as a feed to determine whether or not to run a batch file. I need to make sure that the PC's are offline before the batch file is run! This whole test is done using a dos batch file!

An early response shall be highly valued. Thanks in advance.


Best regards



Deepak
 

My Computer

OS
Windows 7 Professional 64 bit
CPU
i7, 920
Memory
6GB DDR3
Hello there


Any suggestions on this please!



Best regards



Deepak
 

My Computer

OS
Windows 7 Professional 64 bit
CPU
i7, 920
Memory
6GB DDR3
The command "ping (IP address)" always sends 4 packets (tries 4 times).
The replies, however, differ when the host is online (Reply from 192.168.X.XXX: bytes=32 time<1ms TTL=128), the host is offline (Reply from 192.168.Y.YYY: Destination host unreachable.) or there is a problem along the way (Request timed out.)

If you issue the command ping -n 2 192.168.X.XXX, it will try 2 times:
Pinging 192.168.X.XXX with 32 bytes of data:
Reply from 192.168.X.XXX: bytes=32 time<1ms TTL=128
Reply from 192.168.X.XXX: bytes=32 time<1ms TTL=128
or
Reply from 192.168.Y.YYY: Destination host unreachable.
Reply from 192.168.Y.YYY: Destination host unreachable.
or
Request timed out.
Request timed out.

Issue the command "ping /?" to see a list of all available options:
Code:
C:\>ping /?

Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
            [-r count] [-s count] [[-j host-list] | [-k host-list]]
            [-w timeout] [-R] [-S srcaddr] [-4] [-6] target_name

Options:
    -t             Ping the specified host until stopped.
                   To see statistics and continue - type Control-Break;
                   To stop - type Control-C.
    -a             Resolve addresses to hostnames.
 [B]   -n count       Number of echo requests to send.[/B]
    -l size        Send buffer size.
    -f             Set Don't Fragment flag in packet (IPv4-only).
    -i TTL         Time To Live.
    -v TOS         Type Of Service (IPv4-only. This setting has been deprecated
                   and has no effect on the type of service field in the IP Header).
    -r count       Record route for count hops (IPv4-only).
    -s count       Timestamp for count hops (IPv4-only).
    -j host-list   Loose source route along host-list (IPv4-only).
    -k host-list   Strict source route along host-list (IPv4-only).
    -w timeout     Timeout in milliseconds to wait for each reply.
    -R             Use routing header to test reverse route also (IPv6-only).
    -S srcaddr     Source address to use.
    -4             Force using IPv4.
    -6             Force using IPv6.
 

My Computer

OS
Windows 7 Enterprise x64 SP1
Hi Zyanwu


Thanks for your response but I don't think that answers my question.


Is it possible that I can get the Ping command response from this computer running Windows 7 as 100% (Loss) for an offline computer as I get in the case of Ping command response executed from a computer running Windows XP?

That is what I am looking for.

At the moment, what is happening is that the Ping command response executed from this computer running Windows 7 for an offline computer shows a 0% Loss since the response is shown to be coming from computer where the Ping command is executed (computer .YYY) and not from the offline computer (.XXX). Whilst I do agree that it does show that the offline is unreachable but I am using the batch file and searching for the %Loss number in the Ping command response to take further actions and I need the appropriate %Loss number as 0 and 100 for online and offline computers.

Any further assistance would be highly appreciated.



Best regards



Deepak
 

My Computer

OS
Windows 7 Professional 64 bit
CPU
i7, 920
Memory
6GB DDR3
I see.

I don't think it's possible to have offline computer replies count as lost packets without patching ping.exe or having a 3rd party application.

I'd use the %errorlevel% returned by the ping | find command.

Code:
C:\>find /?
Searches for a text string in a file or files.

FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]

  /V         Displays all lines NOT containing the specified string.
  /C         Displays only the count of lines containing the string.
  /N         Displays line numbers with the displayed lines.
  /I         Ignores the case of characters when searching for the string.
  /OFF[LINE] Do not skip files with offline attribute set.
  "string"   Specifies the text string to find.
  [drive:][path]filename
             Specifies a file or files to search.

If a path is not specified, FIND searches the text typed at the prompt
or piped from another command.

C:\>ping 127.0.0.1 | find "Reply"
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64

C:\>echo %errorlevel%
0

C:\>ping 127.0.0.1 | find "Destination host unreachable."

C:\>echo %errorlevel%
1

C:\>ping 172.16.1.2 | find "Destination host unreachable."
Reply from 172.16.1.100: Destination host unreachable.
Reply from 172.16.1.100: Destination host unreachable.
Reply from 172.16.1.100: Destination host unreachable.
Reply from 172.16.1.100: Destination host unreachable.

C:\>echo %errorlevel%
0

C:\>
%errorlevel% 0 means the text was found
%errorlevel% 1 means the text was NOT found
 

My Computer

OS
Windows 7 Enterprise x64 SP1
Hi Zyanwu


Yep, that should work. I can try that!

Will let you know how I go! Thanks again, mate!



Best regards


Deepak
 

My Computer

OS
Windows 7 Professional 64 bit
CPU
i7, 920
Memory
6GB DDR3
Back
Top