Ping computers with Time Stamp

Here it is: A small script that pings computer with Time Stamp:

@Echo off
echo %time% > c:\PingServer.txt
Ping 111.34.22.45 >> C:\PingServer.txt

Note the ">>" in above redirector. This redirector enables you to append the file rather than overwrite it.

Will sought more on this if time permits :)

Cool
 

Published Sat, Jan 27 2007 16:17 by Nirmal
Filed under:

Comments

# re: Ping computers with Time Stamp

Hi Nirmal,

I like this script idea.  How would I turn it up a notch though?  I'm looking to add a time stamp on every single reply I get back from the device I am pinging.  How would I do that?  For example:

Pinging 172.25.0.60 with 32 bytes of data:

8:54:52 Reply from 172.25.0.60: bytes=32 time=3ms TTL=64

8:54:53 Reply from 172.25.0.60: bytes=32 time=2ms TTL=64

8:54:54 Reply from 172.25.0.60: bytes=32 time=3ms TTL=64

8:54:55 Reply from 172.25.0.60: bytes=32 time=2ms

Ping statistics for 172.25.0.60:

   Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

   Minimum = 2ms, Maximum = 4ms, Average = 2ms

Is this possible?

Thursday, August 16, 2007 9:12 AM by Rory Schmitz

# re: Ping computers with Time Stamp

Time with each reply = Total Time of Replies -  time=3ms

Thursday, August 16, 2007 11:23 PM by Nirmal

# re: Ping computers with Time Stamp

you can also loop it:

:TOP

echo %time% >> c:\PingServer.txt

Ping 111.34.22.45 >> C:\PingServer.txt

GOTO TOP

Wednesday, August 22, 2007 4:25 PM by michael simmons

# re: Ping computers with Time Stamp

Thank you.  This will assist me with something on which I'm working and will get me a few more hours sleep.  I'll possibly be able to go to church on sunday instead of monitoring a server.

Thursday, September 13, 2007 2:41 PM by Melvin

# dvd decoders for windows

As a heavy metal/ hard rock afficionado I was more than a little suspicious of the talent or the bonafides of Lordi, the Finnish heavy metal band that won this year\'s Eurovision song contest. I mean any song contest with the word Euro in it is going

Tuesday, July 22, 2008 5:16 AM by dvd decoders for windows

# dvd decrypter

scan IP address , scan your TCP/ UDP ports , scan several specifically popular TCP/ UDP ports.

Tuesday, July 22, 2008 6:22 AM by dvd decrypter

# decrypt dvd movie

Many processes run under the name“ SVCHOST. EXE” and when it has problems, it’ s difficult to track down the cause. Examples of problems include system hangs or 100% CPU utilization that is attributed to the service. The performance team of Microsoft

Tuesday, July 22, 2008 7:17 AM by decrypt dvd movie

# shrink dvd size

In my post Controlling computers, I wrote about Jeff Han, whose team has created a mindboggling new prototype for a computer interface. Now, at TED, you can see Jeff show the interface and explain a bit how it works. This is what our kids will be usin

Friday, August 01, 2008 9:01 AM by shrink dvd size

# re: Ping computers with Time Stamp

Hi roy,

Do you success in doing the time-stamp please update me if you could

Thursday, October 09, 2008 6:59 AM by mostafa kamel

# re: Ping computers with Time Stamp

Let me tell you one thing. Ping command doesn't support any API function. Meaning it won't allow you to add your own command in each reply. You have to use mechanism provided by other users.

You can not insert your own command in each reply.

Nirmal.

Thursday, October 09, 2008 7:27 AM by Nirmal

# re: Ping computers with Time Stamp

I found this tool that does a ping with a timestamp. It works great!

www.cfos.de/.../ping.htm

Enjoy!

Wednesday, October 22, 2008 1:12 PM by Dlogan

# Nrxqmgqv

QqxyZO

Tuesday, July 14, 2009 2:39 PM by Nrxqmgqv

# re: Ping computers with Time Stamp

I also found that tool. And this is the command line I use to catch request-timed-out errors with timestamp:

hrping -t -o -F c:\pingcheck.txt -qr -T -s 0 -w 997 example.com

-t constant ping

-o don't do overlapped pinging (to be able to catch timestamps of request timed outs)

-F log also to file

-qr suppress normal replies (to not overflood log files/console)

-T print timestamp

-s time between two ping attempts (0ms)

-w time to wait for reply (997ms)

HTH

Saturday, September 19, 2009 4:43 AM by Henno

# re: Ping computers with Time Stamp

Found a real simple cycle that did the job for me.

@ECHO OFF

:TOP

FOR /F "tokens=3,4,5 delims= " %%A IN ('PING -a %1 -n 1 ^| FIND "Reply"') DO ECHO %DATE% %TIME% %%A %%B %%C >> pingpong.txt

GOTO TOP

hope this helps

Saturday, October 10, 2009 7:26 PM by Jaik

# re: Ping computers with Time Stamp

Looping with a sleep between attempts.

Obtain sleep.exe from Windows Server 2003 Resource Kit Tools

The path to Sleep.exe should also be given.

:TOP

echo %time%>>C:\PingServer.txt

ping -w 20000 -n 1 -l 1 111.34.22.45>>C:\PingServer.txt

C:\sleep 5

GOTO TOP

Tuesday, November 17, 2009 5:09 AM by NeilPaignton

# re: Ping computers with Time Stamp

Use fping

fping www.google.com -t 50000 -c -T -L ping.txt

Tuesday, December 15, 2009 10:58 AM by Bob

# re: Ping computers with Time Stamp

hrping rawks..it really works!

Tuesday, August 17, 2010 10:31 PM by golok

# re: Ping computers with Time Stamp

rem Try below

@Echo off

if ""%1""=="""" goto HELP

if ""%1""==""/?"" goto HELP

echo %0 %1

set result=

for /f "tokens=* delims= " %%a in ('ping %1 -n 1 ^| find /i "reply"') do (

set result="%%a"

)

if ""%result%""=="""" goto :IFELSE_PING

for /f "tokens=3,4,5,6 delims= " %%a in (%result%) do (

set result="%%a %%b %%c %%d"

)

goto ENDIF_PING

:IFELSE_PING

set result="Request timed out."

:ENDIF_PING

rem echo %result%

:KEEP_PINGING

for /f "tokens=* delims= " %%a in (%result%) do (

echo %date% %time% - %%a

)

sleep 1

GOTO KEEP_PINGING

:HELP

echo usage: %0 IP/HOST

Tuesday, August 17, 2010 11:45 PM by Man Cheuk

# re: Ping computers with Time Stamp

hrping doesn't work well with windows vista... is there any alternative tools for vista?

D:\hrping-v244>hrping.exe -T 192.168.1.1

This is hrPING v2.44 by cFos Software GmbH -- http://www.cfos.de

Pinging 192.168.1.1

with 32 bytes data (60 bytes IP):

4 Requests timed out.

Statistics for 192.168.1.1:

   Packets: sent=4, rcvd=0, error=0, lost=4 (100% loss) in 0.000000 sec

hrPing has known problems with Windows Vista and later raw sockets.

Maybe a newer version of hrPing has already fixed them?

Wednesday, August 18, 2010 9:54 AM by golok

# re: Ping computers with Time Stamp for linux

if you need it for linux:

while [ 1 ];do date +"%F %X - `ping -c1 localhost|grep icmp`" >> ping.log;sleep 3;done

Monday, March 21, 2011 6:57 AM by Janak

# re: Ping computers with Time Stamp

starting time 15:13:26

Pinging 172.25.0.60 with 32 bytes of data:

8:54:52 Reply from 172.25.0.60: bytes=32 time=3ms TTL=64

8:54:53 Reply from 172.25.0.60: bytes=32 time=2ms TTL=64

8:54:54 Reply from 172.25.0.60: bytes=32 time=3ms TTL=64

8:54:55 Reply from 172.25.0.60: bytes=32 time=2ms

Ping statistics for 172.25.0.60:

  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

end time 15:15:46

any cmd to view like this?

Tuesday, May 10, 2011 5:45 AM by veera

# re: Ping computers with Time Stamp

I've tweaked the script to:

a) re-execute the ping each time (note the Goto Start in this script which is missing above)

b) work on Windows 7 (which doesn't appear to have a sleep command)

c) as an enhancement, wait 10 seconds between successful pings, but only 2 between unsuccessful)

@Echo off

if ""%1""=="""" goto HELP

if ""%1""==""/?"" goto HELP

Rem

Rem Show that this is running

Rem

echo %0 %1

Rem

:START

set result=

for /f "tokens=* delims= " %%a in ('ping %1 -n 1 ^| find /i "reply"') do (

set result="%%a"

)

if ""%result%""=="""" goto :IFELSE_PING

for /f "tokens=3,4,5,6 delims= " %%a in (%result%) do (

set result="%%a %%b %%c %%d"

)

set delay=10

goto ENDIF_PING

:IFELSE_PING

set result="Request timed out."

set delay=2

:ENDIF_PING

for /f "tokens=* delims= " %%a in (%result%) do (

echo %date% %time% - %%a

)

Rem sleep for delay seconds

ping -n %delay% 127.0.0.1 > NUL 2>&1

GOTO START

:HELP

echo usage: %0 IP/HOST

Wednesday, December 21, 2011 9:05 AM by Andrew K

# re: Ping computers with Time Stamp

How can I check logs og ping.exe aur runing exe?????

Tuesday, May 08, 2012 2:07 AM by Faizan

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above: