中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-26 22:56
47,812 主题排行 / 349,912 发帖 / 今日 2 篇 / 48,264 会员排行
其它操作系统综合讨论区 » 研究了好几天了刚刚找到这里,高手帮我解决一下。
可打印版本  1,117 / 6
第1楼 cxinet 发表于 2007-01-31 19:13
新手上路 发帖 4 积分 10
研究了好几天了刚刚找到这里,高手帮我解决一下。
本人刚刚接触批处理碰到一个头疼的问题
我在写静态路由表时候使用错误网关会出现下面这句(The route addition failed: Either the interface index is wrong or the gateway do
es not lie on the same network as the interface. Check the IP Address Table for
the machine.)
因为这句话很专业,好多领导看不懂所以我想利用批处理简化一下这局话。在出现这句话时候把上面那句英文改为(检查网关);如不出现这句话则直接运行下一句。
这样的批处理可以实现吗?应该如何去写。
在这里先谢谢各位前辈了。
路由表语法是route -p add 192.168.1.2 mask 255.255.255.0 192.168.1.1 metric 1
机器IP是192.168.0.2 网关是192.168.0.1 子网掩码255.255.255.0
我要解决的问题不是如何设置网关、IP或者不让那具英文出现;而是将那句英文改为检查网关四个字。

[ Last edited by cxinet on 2007-1-31 at 06:47 AM ]
第2楼 Climbing 发表于 2007-01-31 22:08
铂金会员 发帖 2,753 积分 6,962 来自 河北保定
首先,你的route -p add那一个命令行是错误的,这可能是导致出现错误的关键,如果彻底消除了错误,恐怕就没有必要检测错误了。

我认为正确的应该是:route -p add 192.168.0.0 mask 255.255.255.0 192.168.0.1 metric 1

至于检测错误,可以使用这种方式:
route -p add .... 2>&1 | find /i "addition failed"
if %errorlevel%==0 echo 请检查网关!
第3楼 jastyg 发表于 2007-02-01 00:31
中级用户 发帖 82 积分 219
route add 192.168.0.0 mask 255.255.255.0 192.168.0.1 metric 1 -p
我都是这样写
第4楼 cxinet 发表于 2007-02-01 05:20
新手上路 发帖 4 积分 10
2楼的大哥能不能写个完整的批处理,那个“至于检测错误,可以使用这种方式”我还是搞不懂。
还有Climbing你是保定的?我也是保定的。
第5楼 cxinet 发表于 2007-02-01 06:22
新手上路 发帖 4 积分 10
上面的静态路由表确实有问题,我的意思是出现(The route addition failed: Either the interface index is wrong or the gateway do
es not lie on the same network as the interface. Check the IP Address Table for
the machine.)这句话时候如何用中文只是,并不是路由表问题。
也就是说不再让The route addition failed: Either the interface index is wrong or the gateway do
es not lie on the same network as the interface. Check the IP Address Table for
the machine.这句话出现了,而是直接出现检查网关

[ Last edited by cxinet on 2007-1-31 at 05:23 PM ]
第6楼 oilio 发表于 2007-02-01 09:03
高级用户 发帖 303 积分 641
哎,好难啊,不仅涉及到命令还涉及到网络。只能干看看了。route是路由命令??
第7楼 Climbing 发表于 2007-02-01 22:25
铂金会员 发帖 2,753 积分 6,962 来自 河北保定
route -p add .... 2>&1 | find /i "addition failed" >nul
if %errorlevel%==0 echo 请检查网关!
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023