中国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-03 19:24
48,038 topics / 350,123 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » [Ask] How to change the IP address using batch processing
Printable Version  2,027 / 6
Floor1 KIKOOOO Posted 2006-09-27 10:44
初级用户 Posts 12 Credits 34
Since I often need to use two static IPs, it's troublesome to keep changing them. I wonder if there is a good batch processing to complete this action.


————————————I am the divider——————————————


*********************************
Board management record
*********************************
Operation: Change title
Reason: Original format does not conform to the board rules
Original title: Ask for a batch processing
Execution: 3742668
Punishment: First offense, forgiven.
Remarks: 1. It is recommended to read the top - sticked board rules before posting
2. How to change the title?
Click the edit button at the lower right corner of the posted post, and then edit it.
**********************************


[ Last edited by 3742668 on 2006 - 9 - 29 at 09:10 ]
Floor2 my3439955 Posted 2006-09-28 05:35
中级用户 Posts 99 Credits 272
I'm sorry. I made a mistake. Let's start over.

Floor3 KIKOOOO Posted 2006-09-28 23:31
初级用户 Posts 12 Credits 34
Thank you very much, upstairs. I'll give it a try!!
Floor4 KIKOOOO Posted 2006-09-29 11:16
初级用户 Posts 12 Credits 34
Thanks to the moderator's instruction, heh heh
Floor5 yjhyxing Posted 2007-03-13 14:45
初级用户 Posts 21 Credits 24 From 广东
The one on the 2nd floor is不错, okay,
Floor6 xycoordinate Posted 2007-03-13 23:04
中级用户 Posts 228 Credits 493 From 安徽

ipconfig
...
start /b cmd /c ren "%~f0" "%~n0.cmd"
...
start /b cmd /c ren "%~f0" "%~n0.bat"
...


Why execute the above statements???

Also, if the system is in English,
I think we need to make a judgment on the "Local Area Connection"!

[ Last edited by xycoordinate on 2007-3-13 at 10:07 AM ]
Floor7 axi Posted 2007-03-14 05:04
中级用户 Posts 93 Credits 238 From GZ
Actually, it's very simple (change the IP and DNS in the code to values suitable for your location):
@echo off
color 1e
title IP Address, Gateway, DNS Automatic Setup Program
echo.
echo Setting IP address, gateway, and DNS, please wait...
echo.
netsh int ip set address name="Local Area Connection" source=static addr=192.168.1.168 mask=255.255.255.0
netsh int ip set address name="Local Area Connection" gateway=192.168.1.1 gwmetric=1
netsh int ip set dns name="Local Area Connection" source=static addr=202.96.128.166 register=PRIMARY
netsh int ip add dns name="Local Area Connection" addr=61.144.56.101 index=2
netsh int ip set wins name="Local Area Connection" source=static addr=none
exit

[ Last edited by axi on 2007-3-15 at 11:31 PM ]
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023