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-25 08:44
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » How to compile a batch file to modify the IP under DOS (XP)? View 2,279 Replies 3
Original Poster Posted 2005-09-19 01:36 ·  中国 湖北 武汉 电信
中级用户
★★
Credits 247
Posts 83
Joined 2005-09-12 12:06
20-year member
UID 42446
Gender Male
Status Offline
I found some information online. The following command can be used to change the local area network IP address:
netsh interface ip set address "Local Area Connection" static 192.168.1.106 255.255.255.0 192.168.1.1 1
When I put this line into a batch file, it doesn't work. Could you all, dear experts, please tell me how to write this batch file?
Also, how can I loop to change IPs (within a certain range)?
Can I change the MAC address using a batch file under XP without restarting?
Thank you, dear experts, and happy Mid-Autumn Festival!
Floor 2 Posted 2005-09-19 20:47 ·  中国 广东 广州 电信
金牌会员
★★★★
D◎$ Fαп
Credits 4,562
Posts 1,883
Joined 2004-01-19 00:00
22-year member
UID 15812
Gender Male
From 广东广州
Status Offline
Since the Netsh command enters another command-line state when running and requires additional commands to be input, you should first create a text file containing the commands that need to be input after Netsh, and then import this file using Netsh. That is:

First, use a text editor (such as Edit or Notepad) to input:
interface
ip
set address "Local Area Connection" static 192.168.1.106 255.255.255.0 192.168.1.1 1
quit
Then save it with any file name, such as change.txt.

Then use the netsh command and the "<" import operator to take change.txt as the input source:
netsh <change.txt
----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
Floor 3 Posted 2005-11-12 13:27 ·  中国 广东 梅州 电信
中级用户
★★
Credits 421
Posts 111
Joined 2003-08-29 00:00
22-year member
UID 9153
Gender Male
Status Offline
Originally posted by JonePeng at 2005-9-19 08:47 PM:
Because the Netsh command enters another command line state when running, and additional commands need to be entered, so you should first create a text file of the commands that need to be entered after Netsh, and then use Netsh to import...


After trying this according to this, a situation of non-stop occurs, and it keeps running, which is running under XP
Floor 4 Posted 2005-11-12 14:00 ·  中国 广东 梅州 电信
中级用户
★★
Credits 421
Posts 111
Joined 2003-08-29 00:00
22-year member
UID 9153
Gender Male
Status Offline
Manual input is okay, but when using batch processing, an error occurs, and the command keeps running without stopping.
Forum Jump: