Timestamp Ping.


B

BaKaR

Hi!

Easy way to Timestamp ping.exe, so if the ping command is: ping www.google.com -t you get like %time% ping reply ... ?

Thank You.
 
Ad

Advertisements

R

Ray at

You want to know the time that you pinged something? Is that what you mean?

echo %time% & ping google.com

Is that what you mean?

Ray at work

BaKaR said:
Hi!

Easy way to Timestamp ping.exe, so if the ping command is: ping
www.google.com -t you get like %time% ping reply ... ?
 
B

BaKaR

Well, not exactly ..
I thought something like this:

Pinging *IP* with 32 bytes of data:

%time% Reply from *IP*: bytes=32 time=1ms TTL=128
%time% Reply from *IP*: bytes=32 time<1ms TTL=128
%time% Reply from *IP*: bytes=32 time<1ms TTL=128
%time% Reply from *IP*: bytes=32 time<1ms TTL=128

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


I want to Prefix every ping reply with a timestamp .. not sure if that is possible without using WSH or VBScript ...


Thank You,
 
M

Mark V

In said:
Well, not exactly ..
I thought something like this:

Pinging *IP* with 32 bytes of data:

%time% Reply from *IP*: bytes=32 time=1ms TTL=128
%time% Reply from *IP*: bytes=32 time<1ms TTL=128
%time% Reply from *IP*: bytes=32 time<1ms TTL=128
%time% Reply from *IP*: bytes=32 time<1ms TTL=128

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


I want to Prefix every ping reply with a timestamp .. not sure if
that is possible without using WSH or VBScript ...
I don't see how it is possible at all as I think that option would need
to exist inside ping.exe.
 
R

Ray at

Why not just timestamp the beginning? The ping request will be a second
apart unless you specified otherwise with the -w switch.

for /f "tokens=*" %%q in ('ping localhost) do (echo %time% %%q)

That would stick a timestamp in front of each line. This does not seem like
it would be fun to read or beneficial though. Perhaps if you tell us the
goal, someone can offer something better.

Ray at work


BaKaR said:
Well, not exactly ..
I thought something like this:

Pinging *IP* with 32 bytes of data:

%time% Reply from *IP*: bytes=32 time=1ms TTL=128
%time% Reply from *IP*: bytes=32 time<1ms TTL=128
%time% Reply from *IP*: bytes=32 time<1ms TTL=128
%time% Reply from *IP*: bytes=32 time<1ms TTL=128

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


I want to Prefix every ping reply with a timestamp .. not sure if that is
possible without using WSH or VBScript ...
 
Ad

Advertisements

B

BaKaR

Hi Again.

Well, i need to ping -t (overnight) few nodes (30).

In the morning (or day after) i need to chk some nodes against others, so i need a timestamp for every Reply i did get, or time out.

for /f "tokens=*" %q in ('ping localhost) do (echo %time% %q) == would almost be nice, just to redirect it to a file, and rid off
the new lines .. maybe i can handle that, ill try.

Thank You,
 
M

Matthias Tacke

BaKaR said:
Hi Again.

Well, i need to ping -t (overnight) few nodes (30).

In the morning (or day after) i need to chk some nodes against others,
so i need a timestamp for every Reply i did get, or time out.
for /f "tokens=*" %q in ('ping localhost) do (echo %time% %q) == would
almost be nice, just to redirect it to a file, and rid off the new
lines .. maybe i can handle that, ill try.
Thank You,
Not a batch solution, but my google search on "multi ping" showed
this one which has a stamped logfile:
http://www.pablovandermeer.nl/body_multi_ping.html

HTH
 
M

Michael Bednarek

Well, i need to ping -t (overnight) few nodes (30).

In the morning (or day after) i need to chk some nodes against others, so i need a timestamp for every Reply i did get, or time out.

for /f "tokens=*" %q in ('ping localhost) do (echo %time% %q) == would almost be nice, just to redirect it to a file, and rid off
the new lines .. maybe i can handle that, ill try.
I'm too lazy to work out the syntax of CMD's "FOR /F"; I use 4NT
instead. The following command
ping localhost | FOR %fu IN (@Con) ECHO %_time "%fu"
produces this output:

11:44:27 ""
11:44:27 "Pinging 127.0.0.1 with 32 bytes of data:"
11:44:27 ""
11:44:27 "Reply from 127.0.0.1: bytes=32 time<10ms TTL=128"
11:44:28 "Reply from 127.0.0.1: bytes=32 time<10ms TTL=128"
11:44:29 "Reply from 127.0.0.1: bytes=32 time<10ms TTL=128"
11:44:30 "Reply from 127.0.0.1: bytes=32 time<10ms TTL=128"
11:44:30 ""
11:44:30 "Ping statistics for 127.0.0.1:"
11:44:30 " Packets: Sent = 4, Received = 4, Lost = 0 (0 loss),"
11:44:30 "Approximate round trip times in milli-seconds:"
11:44:30 " Minimum = 0ms, Maximum = 0ms, Average = 0ms"

The quotes are necessary to prevent the redirection symbol which happens
to occur in the output ("time<10ms") being seen by the parser.

Obviously, this output can be redirected to a file. In addition, 4NT's
LOG command will produce a log file where each command is time-stamped.
These two can be combined by redirecting the command output to the LOG
file as well.

Like most professional tools, 4NT is not free. 4NT's FOR command is
documented at <http://jpsoft.com/help/for.htm>
 
Joined
Aug 3, 2013
Messages
2
Reaction score
0
I know this is an old post but I came across it on a Google search. Since there is no real solution posted here I'll post this.

@echo off
for /f "tokens=*" %%A in ('ping localhost -n 1') do (echo %%A && GOTO Ping)
:ping
for /f "tokens=* skip=2" %%A in ('ping localhost -n 1') do (echo %time% %%A && GOTO Ping)

It prints like the OP wanted, only pings every 4 seconds, and summary info could be added if needed.
 
Last edited:
Ad

Advertisements

Joined
Aug 3, 2013
Messages
2
Reaction score
0
"only pings every 4 seconds" with no reply from host else its every ~.05 seconds so you might want to put in a delay.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Timestamp Problem 5
delete by timestamp 1
Timestamp as Name of File 0
Batch File Timestamp 13
ping -a resolution 3
ping a printer 4
Ping with Tracert 1
TCP/IP ping 1

Top