Quick IP address modification in Windows

Source: Internet
Author: User
Tags dns2

Each time I access the Internet from another location, I have to reset the IP address, which is quite time-consuming. So I wrote a batch of requests for automatic setting.
Save the following code as the **. bat file in notepad, and change the IP address, gateway, DNS, and nic name to your own one. Run the command as an administrator.
(1) set the dynamic IP address and obtain it automatically.
@ ECHO OFF
Echo ip address modification Tool
ECHO is setting to automatically obtain the IP address. Please wait ......
 
Rem NIC is the network name. The system name prevails.
Set NIC = Wireless Network Connection
Rem set NIC = Local Area Connection
 
Netsh interface ip set address name = "% NIC %" source = dhcp
Netsh interface ip set dns name = "% NIC %" source = dhcp
 
ECHO ipset successfully BY GAVIN_DING :)
Pause
(2) set static IP addresses
@ ECHO OFF
Echo ip address modification Tool
ECHO is setting static IP. Please wait ......
 
Set IP = 222.201.189.98
Set MASK = 255.255.255.0
Set GW = 222.201.189.254
Rem NIC is the network name. The system name prevails.
Set NIC = Wireless Network Connection
Rem set NIC = Local Area Connection
Set DNS1 = 222.201.130.30
SET DNS2 = 222.201.130.33
 
Netsh interface ip set address name = "% NIC %" source = static addr = % IP % mask = % MASK %
Netsh interface ip set address name = "% NIC %" gateway = % GW % gwmetric = 0
Netsh interface ip set dns name = "% NIC %" source = static addr = % DNS1 %
Netsh interface ip add dns name = "% NIC %" addr = % DNS2 %
ECHO ipset successfully BY GAVIN_DING :)
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.