Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Batch modification of Windows system IP address

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Copy the following script to a text file and save it as a bat file

Set the name of the network card to the local link and right-click the administrator permission to run it.

@ echo off

Rem / / Set Environment Variable

Set NAME= "Local links"

Rem / / Pleasae enter your IP address as what you want to setup

Set ADDR=192.168.18.249

Set MASK=255.255.255.0

Set GATEWAY=192.168.18.1

Set DNS1=202.96.128.166

Set DNS2=202.96.134.133

Echo Please choose an option as you want to setup

Echo 1 Setup Static IP address For this PC

Echo 2 Setup Dynamic IP address For this PC

Echo 3 Exit

Echo Please choose and press Enter Key:

Set / p operate=

If operate%==1 goto 1

If operate%==2 goto 2

If operate%==3 goto 3

: 1

Echo Setting up static IP,Please wait...

Rem / / Please change following info as your environment!

Echo IP Address =% ADDR%

Echo Netmask =% MASK%

Echo Gateway =% GATEWAY%

Netsh interface ipv4 set address name=%NAME% source=static addr=%ADDR% mask=%MASK% gateway=%GATEWAY% gwmetric=0 > nul

Echo Primary DNS =% DNS1%

Netsh interface ipv4 set dns name=%NAME% source=static addr=%DNS1% register=PRIMARY > nul

Echo Standby DNS =% DNS2%

Netsh interface ipv4 add dns name=%NAME% addr=%DNS2% index=2 > nul

Echo Static IP Setup successfully.

Pause

Goto 3

: 2

Echo Setting up Dynamic IP,Please wait.

Echo Obtaining IP Address from DHCP Server...

Netsh interface ip set address "LAN" dhcp

Echo Obtaining DNS Address from DHCP Server...

Netsh interface ip set dns "LAN" dhcp

Echo Dynamic IP Setup successfully.

Pause

Goto 3

: 3

Exit

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report