本帖最后由 foboy 于 2010-3-10 17:52 编辑
最简单的办法,PING命令本身就可以满足你的要求。
命令格式为:
ping -n 1 -w 100 网站地址
-n 参数为发送指定数量的数据包,默认为4, 你这里设置成1比较合适
-w 超时时间,单位为毫秒。超过这个时间则认为不通并且结束命令。
例子:ping -n 1 -w 500 maijiaoben.com
C:\Documents and Settings\a>ping -n 1 -w 500 maijiaoben.com
Pinging maijiaoben.com [64.120.209.204] with 32 bytes
Reply from 64.120.209.204: bytes=32 time=287ms TTL=48
Ping statistics for 64.120.209.204:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss
Approximate round trip times in milli-seconds:
Minimum = 287ms, Maximum = 287ms, Average = 287ms
|