如何把这两条命令写成一个bat文件

来源:百度知道 编辑:UC知道 时间:2024/09/25 11:19:46
把这两条命令:
route change 0.0.0.0 mask 0.0.0.0 20.1.1.2 metric 10 if 0x3
route add 10.0.0.0 mask 255.0.0.0 10.6.5.253 metric 5 if 0x2
这样子写在一个bat文件里,保存成文件名为:aa.bat,放在桌面上。双击运行它时,总是循环的在运行第一条命令。
我的要求是:双击运行时,顺次执行两条命令后立即退出,要是在开机自动运行更好,请问应该怎么写才行。
谢谢!
interface列表:
D:\Documents and Settings\string.huang>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 1d 7d 10 b2 d1 ...... Realtek RTL8139/810x Family Fast Ethernet NIC -
Kaspersky Anti-Virus NDIS Miniport
0x3 ...00 ac 37 b2 5d f8 ...... SoftEther Virtual LAN Card Adapter - Kaspersky A
nti-Virus NDIS Miniport
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.6.5.253

原因很简单,你的批处理名字就是route.bat,改一个名字就可以了

不用改,默认就是按顺序执行的

可能是你没有2号interface,所以没有执行第二行命令。
在cmd下,用route print命令看下interface 列表。看有没有2、3号

比如我的
C:\Documents and Settings\Administrator>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 1e c9 3f 96 09 ...... Broadcom NetXtreme 57xx Gigabit Controller - Com
mStudio Virtual Adapter by TamoSoft
===========================================================================
我的这个0x1是还回地址,也就是127.0.0.1
0x2是我的物理网卡

你的应该是interface指定错误造成的无法执行

开机自动运行容易,只要吧你做的那个bat批处理文件拖进 开始-程序-启动 里,就可以开机自动运行了

单独拿出来在cmd里执行能运行不?

要不改成两个bat文件用call?
aa.bat

start route change 0.0.0.0 mask 0.0.0.0 20.1.1.2 metric 10 if 0x3
call c:\bb.bat

bb.bat

route add 10.0.0.0 mask 255.0.0.0 10.6.5.253 metric 5