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-22 08:16
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to use batch commands to make a dial-up for a specified IP segment View 1,644 Replies 6
Original Poster Posted 2011-01-05 18:22 ·  中国 江苏 扬州 电信
新手上路
Credits 5
Posts 5
Joined 2011-01-05 11:28
15-year member
UID 180346
Gender Male
Status Offline
I provide an IP's C segment, such as 127.1.12.13, and provide a C segment number 12. After the bat automatically dials, as long as it dials to the C segment (12) I need, it will automatically stop. It would be better if it can identify 2 different C segments at the same time.
Floor 2 Posted 2011-01-05 22:36 ·  中国 江苏 扬州 电信
新手上路
Credits 5
Posts 5
Joined 2011-01-05 11:28
15-year member
UID 180346
Gender Male
Status Offline
Is there any expert here? Please help take a look, thank you.
Floor 3 Posted 2011-01-06 11:02 ·  中国 江苏 扬州 电信
新手上路
Credits 5
Posts 5
Joined 2011-01-05 11:28
15-year member
UID 180346
Gender Male
Status Offline
Bump it up myself, experts, please help啊?Wait, no, the original Chinese "自己顶下,高手们帮忙啊" should be translated as "Bump it up myself, experts, please help" but wait, no, that's not right. Wait, let's do it properly. "自己顶下" is "Bump it up myself", "高手们帮忙啊" is "experts, please help". So the translation is "Bump it up myself, experts, please help" Wait, no, maybe more naturally: "Bumping it up myself, experts, please help." Yes, that's better.
Floor 4 Posted 2011-01-08 10:28 ·  中国 江苏 扬州 电信
新手上路
Credits 5
Posts 5
Joined 2011-01-05 11:28
15-year member
UID 180346
Gender Male
Status Offline
Floor 5 Posted 2011-01-08 16:34 ·  中国 湖北 荆门 电信
初级用户
★★
Credits 186
Posts 117
Joined 2006-08-14 14:50
19-year member
UID 60491
Status Offline
This is very simple.
First, use rasdial to dial, then use netsh or ipconfig to get the IP, and finally use findstr to check if ".12." exists. Of course, other methods can also be used for judgment.
If it meets the requirements, then...
Otherwise, use rasdial to disconnect the connection.
The specific commands may involve the specific information of your connection. It is recommended to Google the usage of relevant commands.
Floor 6 Posted 2011-01-12 11:52 ·  中国 江苏 扬州 仪征市 电信
新手上路
Credits 5
Posts 5
Joined 2011-01-05 11:28
15-year member
UID 180346
Gender Male
Status Offline
First, thank you to the person above. Is there a detailed method? Thanks~~

[ Last edited by jackchen2010 on 2011-1-12 at 12:16 ]
Floor 7 Posted 2011-01-12 15:47 ·  中国 湖南 长沙 电信
初级用户
★★
Credits 103
Posts 52
Joined 2007-04-13 05:20
19-year member
UID 84975
Gender Male
Status Offline
```code
@echo off&&setlocal enabledelayedexpansion
wget "http://www.ip138.com/ip2city.asp" -q -O tmp.txt
for /f "tokens=1-4 delims=" %%i in ('findstr "您的IP地址是:" tmp.txt') do (
set var=%%j
for /f "tokens=1-4 delims=." %%a in ("!var!") do (
set ipa=%%a
set ipb=%%b
set ipc=%%c
set ipd=%%d
echo !ipa! !ipb! !ipc! !ipd!
))
pause.


The IP segmentation is written for you, and you can add the subsequent judgments, disconnections, and dial-ups by yourself.
Forum Jump: