Create a new file under C drive Ping.vbs
Enter the following code in the Ping.vbs:
Dimargs, flag, Unsuccoutargs=""Otherout=""Flag=0IfWScript.Arguments.count =0 ThenWScript.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.QuitEnd if forI=0 toWScript.Arguments.count-1args=args &" "&wscript.arguments (i)NextSet Shell= WScript.CreateObject ("Wscript.Shell")SetRe=NewRegexpre.pattern="^reply|^request|^ from |^ request"Setmyping=Shell. Exec ("Ping"&args) while notmyping. Stdout.atendofstream StrLine=myping. Stdout.readline ()'WScript.Echo "Raw Data" & Chr (9) & StrLineR=Re. Test (StrLine)IfR ThenWScript.EchoDate&" "& Time &CHR(9) &Strlineflag=1 ElseUnsuccout=unsuccout &StrLineEnd ifWendifFlag =0 ThenWScript.Echo UnsuccoutEnd if
At the command line, enter
CD/ping -w>sseping.txt
Ping in Windows environment timestamp log