如何在ping 命令结果前面加上时间日期!!!
我现在打算测试一个网络是否正常.要观察几天.打算用ping的方式检查.但只有下面的显示:
Pinging 10.111.23.1 with 32 bytes of data:
Reply from 10.111.23.1 : bytes=32 time=2ms TTL=255
Reply from 10.111.23.1 : bytes=32 time=2ms TTL=255
Reply from 10.111.23.1 : bytes=32 time=1ms TTL=255
无法定位是在哪个时间里出现的.我想在前面加上时间如:
Pinging 10.111.23.1 with 32 bytes of data:
2005-09-09 00:00:00 Reply from 10.111.23.1 : bytes=32 time=2ms TTL=255
2005-09-09 00:00:01 Reply from 10.111.23.1 : bytes=32 time=2ms TTL=255
2005-09-09 00:00:02 Reply from 10.111.23.1 : bytes=32 time=1ms TTL=255
哪位大侠知道bat的批处理该如何实现?
如何在ping 命令结果前面加上时间日期!!!
我有一个笨办法while [ 1 ];do
date;ping ip -c 1
done
如何在ping 命令结果前面加上时间日期!!!
while [ 1 ];dodate;ping ip -c 1
done
这个写在bat里是无法执行的吧.能否具体点呢
如何在ping 命令结果前面加上时间日期!!!
怎么没有人回复哟.....如何在ping 命令结果前面加上时间日期!!!
while [ 1 ];do
date;ping ip -c 1
done
这个写在bat里是无法执行的吧.能否具体点呢
我以为你是linux系统。
很久没碰dos了。帮不了你。
如何在ping 命令结果前面加上时间日期!!!
@echo off:START
date/t >> aa.txt
time/t >> aa.txt
ping 10.111.23.1 -n 10 >>aa.txt
goto START
稍微变通的方法,呵呵。
[ 本帖最后由 AmoyOriole 于 2006-4-4 08:57 编辑 ]
如何在ping 命令结果前面加上时间日期!!!
谢谢:AmoyOriole不过这种格式打印出来的结果时间怎么一直不变呢?是语句哪里有问题?
2005-09-13 星期二
19:09
Pinging 134.230.55.1 with 32 bytes of data:
Reply from 134.230.55.1: bytes=32 time=2ms TTL=255
Reply from 134.230.55.1: bytes=32 time=2ms TTL=255
Reply from 134.230.55.1: bytes=32 time=2ms TTL=255
Ping statistics for 134.230.55.1:
Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 2ms, Average = 2ms
2005-09-13 星期二
19:09
Pinging 134.230.55.1 with 32 bytes of data:
Reply from 134.230.55.1: bytes=32 time=2ms TTL=255
Reply from 134.230.55.1: bytes=32 time=3ms TTL=255
Reply from 134.230.55.1: bytes=32 time=2ms TTL=255
Ping statistics for 134.230.55.1:
Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 3ms, Average = 2ms
2005-09-13 星期二
19:09
Pinging 134.230.55.1 with 32 bytes of data:
Reply from 134.230.55.1: bytes=32 time=2ms TTL=255
Ping statistics for 134.230.55.1:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 2ms, Average = 2ms
如何在ping 命令结果前面加上时间日期!!!
time/t只精确到分钟。改成ehco. |time >;>; aa.txt 就可以了。
如何在ping 命令结果前面加上时间日期!!!
谢谢了,我又学到了一些东西!如何在ping 命令结果前面加上时间日期!!!
Set shell = WScript.CreateObject("WScript.Shell")
Set re=New RegExp
re.Pattern = "^Reply|^Request"
Set myping=shell.Exec("ping 192.168.0.249")
while Not myping.StdOut.AtEndOfStream
strLine = myping.StdOut.ReadLine()
r=re.Test(strLine)
If r Then
WScript.Echo date & " "& time & chr(9) & strLine
End if
Wend
保存成tping.vbs
在command下执行cscript tping.vbs
输出结果
2005-9-14 12:02:01 Reply from 192.168.0.249: bytes=32 time<10ms TTL=64
2005-9-14 12:02:02 Reply from 192.168.0.249: bytes=32 time<10ms TTL=64
2005-9-14 12:02:03 Reply from 192.168.0.249: bytes=32 time<10ms TTL=64
2005-9-14 12:02:04 Reply from 192.168.0.249: bytes=32 time<10ms TTL=64