Ping With Timestamp and Log the Output in Windows.

By | April 10, 2022

The ping command is one of the primary network troubleshooting tools to test reachability between the source and destination.

Ping uses Internet Control Message Protocol (ICMP) to send out a message called ECHO_REQUEST to the destination computer and waits for an ECHO_REPLY packet.

Timestamp ping is a great tool for troubleshooting the network. It will give you the ping
report along with the time frame so that you can identify what was the issue at that
particular time frame.

in this post, we will discuss, How we can ping to a destination with having a timestamp in windows CLI, and also we will see how we can log that ping report in our computer for later investigation. by default when we ping to a destination we can’t see the time stamp of a ping packet. Let’s ping to a destination and check what it shows us by default.

Note:-To run these ping commands you need to run your CMD as an administrator.

C:\>ping google.com

Pinging google.com [142.250.206.174] with 32 bytes of data:
Reply from 142.250.206.174: bytes=32 time=45ms TTL=118
Reply from 142.250.206.174: bytes=32 time=44ms TTL=118
Reply from 142.250.206.174: bytes=32 time=47ms TTL=118
Reply from 142.250.206.174: bytes=32 time=45ms TTL=118

Ping statistics for 142.250.206.174:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 44ms, Maximum = 47ms, Average = 45ms

C:\>

As you can see above report we could not see the timestamp of each packet, now let’s see the time stamp ping.

1-Ping With Time Stamp

lets ping to 8.8.4.4 , which is the google DNS.and we will see the ping reports with time stamps.The command is given below.

ping -t 8.8.4.4 |cmd /q /v /c "(pause&pause)>nul & for /l %a in () do (set /p "data=" && echo(!date! !time! !data!)&ping -n 2 8.8.4.4>nul"

Let’s ping see the result.

C:\>ping -t 8.8.4.4 |cmd /q /v /c "(pause&pause)>nul & for /l %a in () do (set /p "data=" && echo(!date! !time! !data!)&ping -n 2 8.8.4.4>nul"
Sun 04/10/2022 19:35:45.01 Pinging 8.8.4.4 with 32 bytes of data:
Sun 04/10/2022 19:35:46.10 Reply from 8.8.4.4: bytes=32 time=44ms TTL=118
Sun 04/10/2022 19:35:47.18 Reply from 8.8.4.4: bytes=32 time=44ms TTL=118
Sun 04/10/2022 19:35:48.26 Reply from 8.8.4.4: bytes=32 time=44ms TTL=118
Sun 04/10/2022 19:35:49.35 Reply from 8.8.4.4: bytes=32 time=44ms TTL=118
Sun 04/10/2022 19:35:50.43 Reply from 8.8.4.4: bytes=32 time=44ms TTL=118
Sun 04/10/2022 19:35:51.52 Reply from 8.8.4.4: bytes=32 time=47ms TTL=118
Sun 04/10/2022 19:35:52.60 Reply from 8.8.4.4: bytes=32 time=44ms TTL=118
Sun 04/10/2022 19:35:53.68 Reply from 8.8.4.4: bytes=32 time=44ms TTL=118
Sun 04/10/2022 19:35:54.76 Reply from 8.8.4.4: bytes=32 time=46ms TTL=118
Sun 04/10/2022 19:35:55.83 Reply from 8.8.4.4: bytes=32 time=44ms TTL=118
Sun 04/10/2022 19:35:56.91 Reply from 8.8.4.4: bytes=32 time=44ms TTL=118
Sun 04/10/2022 19:35:57.99 Reply from 8.8.4.4: bytes=32 time=44ms TTL=118
Sun 04/10/2022 19:35:59.07 Reply from 8.8.4.4: bytes=32 time=72ms TTL=118
Sun 04/10/2022 19:36:00.15 Reply from 8.8.4.4: bytes=32 time=45ms TTL=118
Sun 04/10/2022 19:36:01.22 Reply from 8.8.4.4: bytes=32 time=43ms TTL=118
Sun 04/10/2022 19:36:02.29 Reply from 8.8.4.4: bytes=32 time=43ms TTL=118
Sun 04/10/2022 19:36:03.36 Reply from 8.8.4.4: bytes=32 time=44ms TTL=118
Sun 04/10/2022 19:36:04.44 Reply from 8.8.4.4: bytes=32 time=44ms TTL=118
^C
C:\>

2-Ping With Time Stamp and Save The Output in a Text File.

Now let’s ping to the 8.8.4.4 with the timestamp and we will save that ping result in a text file on our desktop. The command I have given below.

ping -t 8.8.4.4|cmd /q /v /c "(pause&pause)>nul & for /l %a in () do (set /p "data=" && echo(!date! !time! !data!)&ping -n 2 8.8.4.4>nul" >C:\users\LAXMI\Desktop\ping.txt

Above you can see I have given the file pathname(C:\users\LAXMI\Desktop\ping.txt) , this is very important, and make sure that your CMD is running in administrative mode. Now let’s run the command and the file called ping.txt should be created on our desktop.

C:\WINDOWS\system32>ping -t 8.8.4.4|cmd /q /v /c "(pause&pause)>nul & for /l %a in () do (set /p "data=" && echo(!date! !time! !data!)&ping -n 2 8.8.4.4>nul" >C:\users\LAXMI\Desktop\ping.txt


Once you will run the above command and press enter then you can see the file called ping.txt has been created on your desktop. Now let’s verify on our desktop.

The file ping.txt has been created successfully on our desktop and now let’s open that file
and see the results.

Leave a Reply

Your email address will not be published.