中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-01 19:02
48,037 topics / 350,122 posts / today 2 new / 48,249 members
DOS批处理 & 脚本技术(批处理室) » About modifying the gateway directly with batch processing
Printable Version  3,012 / 6
Floor1 alfredhou Posted 2006-06-16 10:43
初级用户 Posts 34 Credits 100
Can batch processing directly modify the gateway of the XP system? It can be done by manually entering NETSH in the CMD and then entering commands step by step. But I can't figure out how to do it in batch processing. Moreover, I need the IP to remain unchanged and only the gateway to be changed. I ask you all, is there a good way? Thanks in advance
Floor2 kingljp Posted 2006-06-16 11:04
初级用户 Posts 29 Credits 80
Young man, you didn't post in the right place. Search the forum, I answered this question before.
Floor3 bagpipe Posted 2006-06-16 11:11
银牌会员 Posts 425 Credits 1,144 From 北京
netsh interface ip set address "Local Area Connection" static IP address subnet mask default gateway 1
Floor4 alfredhou Posted 2006-06-16 11:15
初级用户 Posts 34 Credits 100
Dude, I've searched and read, but it's not really working out.

netsh interface ip set address is for changing the IP. Now the problem is I can't pre - determine what the IP of the machine running this batch at that time will be, and I can't change its IP, only its gateway.

I have an idea myself, using IPCONFIG/ALL >1.TXT combined with FINDSTR to find the IP and then using NETSH, but I can't make this idea work. Please give more advice.

Thanks
Floor5 bagpipe Posted 2006-06-16 13:15
银牌会员 Posts 425 Credits 1,144 From 北京
for /f "tokens=2 delims=:" %%i in ('"ipconfig|findstr /I /c:"ip address""') do set a=%%i
Isn't this okay?
Floor6 willsort Posted 2006-06-17 15:26
元老会员 Posts 1,512 Credits 4,432

───────────────── Moderation Log ─────────────────
Performed by: Will Sort
Action: Move Topic: From DOS Troubleshooting & Discussion (Help Desk)
Explanation: According to the topic content classification, it is more suitable to be posted in this forum area
Punishment: Deducted 6 points of rewards for posting this topic, and 2 points of points deducted for forum area violations
───────────────── Moderation Log ─────────────────
Floor7 senffon Posted 2006-06-19 15:02
初级用户 Posts 66 Credits 118
@echo off
color 0b
echo.
echo.
echo. ==============================================================
echo.
echo.
echo. In order to optimize the online quality in recent days, this internet cafe has made corresponding adjustments to the online line!
set /p var= Please press any key to start switching!
echo.
echo. ==============================================================
echo.

echo.
echo. Changing to a faster line for you, please wait ........
echo. .............................................................
netsh i i set address name="Local Area Connection" gateway=192.168.0.254 gwmetric=0
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023