Batch modify IP settings

Source: Internet
Author: User
Tags dns2

@ Echo off
CLS
Color 0a
Echo **************************************
Echo * IP address fast switching wywine@126.com *
Echo **************************************

Set IP = 192.168.100.100
Set mask = 255.255.254.0
Set gateway = 192.168.100.254
Set dns1 = 192.168.100.1
Set dns2 = 202.115.32.39
Set interface = Local Connection

: Menu
Echo.
For Echo quick setting, press 1.
Echo.
For Echo manual setting, press 2.
Echo.
Press 3 when ECHO is created by default.
Echo.
For Automatic Echo retrieval, Press 4.
Echo.
Follow 5 to view the echo status.
Echo.
Press any key to exit echo.
Echo.
Set/P key = [enter your choice:]

If % key % = 1 goto quick
If % key % = 2 goto Manual
If % key % = 3 goto default
If % key % = 4 goto DHCP
If % key % = 5 goto look
If % key % = "" Goto end
Goto end
: Look
Echo.
Ipconfig
Echo.
Echo this program modifies the "local connection" settings by default.
Echo.
To modify the echo, press the corresponding number key,
Echo.
Echo example: Input 2 to change to "local connection 2"
Echo.
Echo English operating system press E2, any key to continue!
Echo.
Set/P intemp = [enter the number of the local connection]
If % intemp % = 1 Set interface = Local Connection
If % intemp % = 2 set interface = Local Connection 2
If % intemp % = 3 set interface = Local Connection 3
If % intemp % = 4 set interface = Local Connection 4
If % intemp % = 5 set interface = Local Connection 5
If % intemp % = e1 set interface = Local Area Connection
If % intemp % = e2 set interface = Local Area Connection 2
If % intemp % = E3 set interface = Local Area Connection 3
If % intemp % = e4 set interface = Local Area Connection 4
If % intemp % = E5 set interface = Local Area Connection 5
CLS
Goto menu

: Quick
If not exist ip.txt copy con ip.txt
If exist ip.txt goto qdo
Echo.
No Default setting file found in Echo!
Goto end

: Qdo
Netsh-F./ip.txt
Echo.
ECHO has been set according to the default settings!
Goto end

: Default
Netsh-C interface IP dump>./ip.txt
Echo.
ECHO is generated by default!
Goto end

: DHCP
Echo.
Echo quickly sets the IP address and DNS to "automatically obtained"
Echo.
Netsh interface IP Set address "Local Connection" DHCP
Netsh interface IP Set DNS "Local Connection" DHCP
Goto end

: Manual
Echo.
Echo you have selected to manually modify the settings.
Echo.

The default echo IP address is % IP %. Press enter to enter the default IP address.
Set/p ip = [enter the IP Address:]
Echo.
The default echo mask is % mask %. Press enter to enter the default value.
Set/P mask = [enter the mask address:]
Echo.
The default echo gateway address is % gateway %. Press enter to enter the default address.
Set/P gateway = [enter the gateway address:]
Echo.
Echo: the default primary DNS address is % dns1 %. Press enter to enter the default address.
Set/P dns1 = [enter the primary DNS address:]
Echo.
The default second DNS address of ECHO is % dns2 %. Press enter to enter the default address.
Set/P dns2 = [enter the second DNS address:]
Echo.
Goto list

: List
ECHO is about to set "% interface %"
The IP address that ECHO will take effect soon is % IP %
The mask that ECHO will take effect soon is % mask %
The gateway address that ECHO will take effect soon is % gateway %
The main DNS address that ECHO will take effect soon is % dns1 %
The second DNS address that ECHO will take effect soon is % dns2 %
Echo.
Set/P reen = [change immediately press 1, reset press 2, exit press any key]
If % reen % = 1 goto do
If % reen % = 2 goto Manual
Goto end

: Do
Echo.
ECHO is changing IP ......
Echo.

Echo IP address and subnet mask set
Netsh interface IP Set address name = "% interface %" Source = static ADDR = % IP % mask = % mask %
Echo gateway address set
Netsh interface IP Set address name = "% interface %" Gateway = % gateway % gwmetric = 0
Echo primary DNS address set
Netsh interface IP Set DNS name = "% interface %" Source = static ADDR = % dns1 % register = primary
Echo second DNS address set
Netsh interface IP add DNS name = "% interface %" ADDR = % dns2 % Index = 2
Goto end

: End
Echo.
Pause

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.