中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-08-08 12:17
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 关于自动获取最快速的QQ服务器的问题 查看 760 回复 2
楼 主 关于自动获取最快速的QQ服务器的问题 发表于 2008-05-11 04:47 ·  中国 广东 佛山 禅城区 电信
初级用户
积分 87
发帖 42
注册 2008-05-07 23:37
18年会员
UID 118057
性别 男
状态 离线
@ echo off
ping sz.tencent.com > a.txt
ping sz1.tencent.com >> a.txt
ping sz2.tencent.com >> a.txt
ping sz3.tencent.com >> a.txt
ping sz4.tencent.com >> a.txt
ping sz5.tencent.com >> a.txt
ping sz6.tencent.com >> a.txt
ping sz7.tencent.com >> a.txt
输入以上代码后可以手动从a.txt中找出最快速的QQ服务器,那么用什么代码能自动判别呢?????????????

[ Last edited by youling126 on 2008-5-12 at 12:42 PM ]
2 发表于 2008-05-11 05:10 ·  中国 上海 联通
版主
★★★★★
积分 9,023
发帖 5,017
注册 2007-05-31 19:39
19年会员
UID 89899
性别 男
状态 离线
我写过一个类似的BAT,思路是这样的:

取ping的结果中最后一行Average的时间作为该服务器的响应时间,如果时间是0,就认为该服务器是最佳服务器。如果所有服务器的响应时间都不是0,就取它们中最小的值(这里比较繁琐,因为批处理中无法直接比较两个数字的大小,我的方法是先比较数字的长度,如果长度相等再比较大小)。

由于不同计算机的ping返回结果的格式也可能不同,楼主最好先ping一下自己然后把结果贴出来给大家看看。
3 我的ping结果,帮忙写一个吧 发表于 2008-05-11 05:42 ·  中国 广东 佛山 禅城区 电信
初级用户
积分 87
发帖 42
注册 2008-05-07 23:37
18年会员
UID 118057
性别 男
状态 离线
Pinging sz.tencent.com [219.133.49.173] with 32 bytes of data:



Reply from 219.133.49.173: bytes=32 time=53ms TTL=55

Reply from 219.133.49.173: bytes=32 time=167ms TTL=55

Reply from 219.133.49.173: bytes=32 time=151ms TTL=55

Reply from 219.133.49.173: bytes=32 time=59ms TTL=55



Ping statistics for 219.133.49.173:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 53ms, Maximum = 167ms, Average = 107ms



Pinging sz1.tencent.com [61.140.3.66] with 32 bytes of data:



Reply from 61.140.3.66: bytes=32 time=17ms TTL=56

Reply from 61.140.3.66: bytes=32 time=29ms TTL=56

Reply from 61.140.3.66: bytes=32 time=33ms TTL=56

Reply from 61.140.3.66: bytes=32 time=61ms TTL=56



Ping statistics for 61.140.3.66:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 17ms, Maximum = 61ms, Average = 35ms



Pinging sz2.tencent.com [58.60.14.43] with 32 bytes of data:



Reply from 58.60.14.43: bytes=32 time=55ms TTL=54

Reply from 58.60.14.43: bytes=32 time=121ms TTL=54

Reply from 58.60.14.43: bytes=32 time=44ms TTL=54

Reply from 58.60.14.43: bytes=32 time=21ms TTL=54



Ping statistics for 58.60.14.43:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 21ms, Maximum = 121ms, Average = 60ms



Pinging sz3.tencent.com [219.133.48.88] with 32 bytes of data:



Reply from 219.133.48.88: bytes=32 time=242ms TTL=55

Reply from 219.133.48.88: bytes=32 time=33ms TTL=55

Reply from 219.133.48.88: bytes=32 time=55ms TTL=55

Reply from 219.133.48.88: bytes=32 time=19ms TTL=55



Ping statistics for 219.133.48.88:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 19ms, Maximum = 242ms, Average = 87ms



Pinging sz4.tencent.com [58.60.14.37] with 32 bytes of data:



Reply from 58.60.14.37: bytes=32 time=20ms TTL=54

Reply from 58.60.14.37: bytes=32 time=40ms TTL=54

Reply from 58.60.14.37: bytes=32 time=23ms TTL=54

Reply from 58.60.14.37: bytes=32 time=81ms TTL=54



Ping statistics for 58.60.14.37:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 20ms, Maximum = 81ms, Average = 41ms



Pinging sz5.tencent.com [58.61.34.26] with 32 bytes of data:



Reply from 58.61.34.26: bytes=32 time=121ms TTL=54

Reply from 58.61.34.26: bytes=32 time=54ms TTL=54

Reply from 58.61.34.26: bytes=32 time=39ms TTL=54

Reply from 58.61.34.26: bytes=32 time=23ms TTL=54



Ping statistics for 58.61.34.26:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 23ms, Maximum = 121ms, Average = 59ms



Pinging sz6.tencent.com [58.251.63.71] with 32 bytes of data:



Reply from 58.251.63.71: bytes=32 time=21ms TTL=50

Reply from 58.251.63.71: bytes=32 time=96ms TTL=50

Reply from 58.251.63.71: bytes=32 time=23ms TTL=50

Reply from 58.251.63.71: bytes=32 time=21ms TTL=50



Ping statistics for 58.251.63.71:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 21ms, Maximum = 96ms, Average = 40ms



Pinging sz7.tencent.com [121.14.75.61] with 32 bytes of data:



Reply from 121.14.75.61: bytes=32 time=91ms TTL=54

Reply from 121.14.75.61: bytes=32 time=38ms TTL=54

Reply from 121.14.75.61: bytes=32 time=452ms TTL=54

Reply from 121.14.75.61: bytes=32 time=23ms TTL=54



Ping statistics for 121.14.75.61:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 23ms, Maximum = 452ms, Average = 151ms
论坛跳转: