Create a new file under C drive Ping.vbs
Enter the following code in the Ping.vbs:
Dim args, flag, unsuccoutargs= "" otherout= "" flag=0if WScript.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 iffor i=0 to wscript.arguments.count-1args= Args & "" & WScript.Arguments (i) nextset shell = WScript.CreateObject ("Wscript.Shell") Set re=new Regexpre.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 thenwscript.echo Date & "" & Time & Chr (9) & Strlineflag=1 Elseunsuccout=unsuc COut & strLine End ifwendif flag = 0 Thenwscript.echo unsuccoutend If
Cut to the directory where the script is located, then call CMD and execute the following command
cscript ping.vbs www.baidu.com-t-L 1000-w 5000>sseping.txt
Windows Ping plus timestamp