先判断1.txt的文件内容,
1.如果有 Lost = 4 则在文件后面加上 测试不通过,
2.如果有 Reply from 则在文件后面加上 测试通过
3.如果是 Ping request could not find host www.*.com Please check the name and try again. 则在文件后面加上 无法解析目标主机名。
4.如果有 TTL Expired in Transit 则在文件后面加上 所需跃点的数目超过了“生存时间”(TTL)。
5.如果是 Destination Host Unreachable 则在文件后面加上 在发送主机或路由器上不存在目标主机的本地或远程路由。
_______________________________________________
如果有下面这样这样信息
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Request timed out.
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
______________________________________________________
则替换成下面这样 。
______________________________________________________
正在用 32 字节数据 Ping 127.0.0.1: (替换成这样也行 Pinging 127.0.0.1 正在用 32 字节数据发送)
应答来自 127.0.0.1: 字节=32 时间<1ms TTL=64
应答超时.
应答来自 127.0.0.1: 字节=32 时间<1ms TTL=64
应答来自 127.0.0.1: 字节=32 时间<1ms TTL=64
127.0.0.1 的 Ping 统计: (替换成这样也行 Ping 统计为 127.0.0.1:)
包: 已发送 = 4,已收到 = 4,已丢失 = 0 (0% 丢失)
以毫秒为单位的大约来回行程的时间:
最小值 = 0ms, 最大值 = 0ms, 平均值 = 0ms
________________________________________________________
2000/XP等NT系统使用,使用系统的命令完成。
127.0.0.1 可能为其它 IP ,即还有2.txt、3.txt等文件 127.0.0.1可能为192.168.0.1或
www.21cn.com等。
只是批处理中的一部分功能,可以使用 转跳、调用、生成等一切方式,但命令必须系统自带。
如果替换太麻烦,可先做判断的。ping 好像只会返回上面那5种结果。
先说声谢谢,可能星期一再看。
Last edited by yangzhiyi on 2006-10-29 at 08:12 AM ]
First, determine the content of file 1.txt.
1. If there is Lost = 4, then add "Test failed" at the end of the file.
2. If there is "Reply from", then add "Test passed" at the end of the file.
3. If it is "Ping request could not find host www.*.com Please check the name and try again.", then add "Target host name cannot be resolved." at the end of the file.
4. If there is "TTL Expired in Transit", then add "The number of required hops exceeds the 'Time to Live' (TTL)." at the end of the file.
5. If it is "Destination Host Unreachable", then add "There is no local or remote route to the target host on the sending host or router." at the end of the file.
_______________________________________________
If there is the following information:
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Request timed out.
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
______________________________________________________
Then replace it with the following.
______________________________________________________
Pinging 127.0.0.1 with 32 - byte data: (It is also acceptable to replace it with Pinging 127.0.0.1 is sending with 32 - byte data)
Reply from 127.0.0.1: bytes = 32 time < 1ms TTL = 64
Reply timed out.
Reply from 127.0.0.1: bytes = 32 time < 127.0.0.1's Ping statistics: (It is also acceptable to replace it with Ping statistics for 127.0.0.1:)
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss)
Approximate round trip times in milliseconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
________________________________________________________
For NT systems such as 2000/XP, use the commands of the system to complete.
127.0.0.1 may be other IPs, that is, there are other files such as 2.txt, 3.txt, etc., and 127.0.0.1 may be 192.168.0.1 or
www.21cn.com, etc.
It is just a part of the functions in batch processing. You can use all methods such as jumps, calls, generation, etc., but the commands must be built - in to the system.
If replacement is too troublesome, you can first make judgments. Ping seems to only return the above 5 kinds of results.
Say thank you first, and may check it on Monday.
Last edited by yangzhiyi on 2006 - 10 - 29 at 08:12 AM ]