China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-29 06:47
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to use batch processing to make an automatic connection View 1,811 Replies 2
Original Poster Posted 2011-01-12 16:37 ·  中国 湖南 株洲 电信
新手上路
Credits 2
Posts 1
Joined 2011-01-11 11:17
15-year member
UID 180626
Gender Male
Status Offline
I need to execute the following command at boot time
route add 192.168.1.119 mask 255.255.255.255 200.200.200.5 if 0x10006
0x10006 is the interface number of WAN (PPP/SLIP)

The question is
1. As soon as the power is cut off, the 0x10006 interface number will also disappear. When the power is re - powered on, is the command "route add 192.168.1.119 mask 255.255.255.255 200.200.200.5 if 0x10006" still valid?

2. If it is invalid, then how to make the batch processing automatically add the command "route add 192.168.1.119 mask 255.255.255.255 200.200.200.5 if 0x10006" as soon as 0x10006 appears?
Floor 2 Posted 2011-01-14 16:41 ·  中国 北京 联通
新手上路
Credits 10
Posts 10
Joined 2010-11-18 20:41
15-year member
UID 177819
Gender Male
Status Offline
First, print all interfaces using route print, then use findstr to find the corresponding lines. Then intercept the interface number. Hmm, that should be the idea, right?
Floor 3 Posted 2011-01-14 16:53 ·  中国 北京 联通
新手上路
Credits 10
Posts 10
Joined 2010-11-18 20:41
15-year member
UID 177819
Gender Male
Status Offline
```
for /f "tokens=1 delims= " %%i in ('route print ^| findstr -i /C:"WAN(PPP/SLIP)"') do echo %%i
```

[ Last edited by eminjin on 2011-1-14 at 16:58 ]
Forum Jump: