In Windows conditions, ping plus timestamp, and save to file
Reprint: http://blog.csdn.net/byply/article/details/50628403
1. Create a new "Ping.vbs" file in the D drive , enter the following code:
Dim args, flag, unsuccout
Args= ""
Otherout= ""
Flag=0
If WScript.Arguments.count = 0 Then
WScript.Echo "Usage:cscript Tping.vbs [-t] [-a] [-N Count] [-l size] [-f] [-I TTL] [-v TOS]"
WScript.Echo "[-S count] [[-j host-list] | [-K host-list]] "
WScript.Echo "[-R Count] [-w timeout] destination-list"
Wscript.Quit
End if
For I=0 to Wscript.arguments.count-1
Args=args & "" & WScript.Arguments (i)
Next
Set shell = WScript.CreateObject ("Wscript.Shell")
Set re=new REGEXP
Re. Pattern= "^reply|^request|^ from |^ request"
Set Myping=shell. Exec ("ping" & args)
While not myping. Stdout.atendofstream
Strline=myping. Stdout.readline ()
' WScript.Echo ' "Raw Data" & Chr (9) & StrLine
R=re. Test (StrLine)
If R Then
WScript.Echo Date & "" & Time & Chr (9) & StrLine
Flag=1
Else
Unsuccout=unsuccout & StrLine
End if
Wend
If flag = 0 Then
WScript.Echo Unsuccout
End If
2. Enter the following command:
cscript ping.vbs www.baidu.com-t-L 1000-w 5000>sseping.txt
This article is from the "Wind Valley" blog, please be sure to keep this source http://chenchunjia.blog.51cto.com/1878790/1942141
In Windows conditions, ping plus timestamp, and save to file