Windows Setup Script IP

Source: Internet
Author: User
Tags domain name server

There is no doubt that setting up IP in Windows is very convenient because there is a simple and intuitive interface to operate. Setting the IP through the graphical user interface is generally sufficient. However, for those who travel frequently, a person-generated conversion work, such a change in IP is undoubtedly time-consuming and inconvenient. Assume that a set of IP commands in the script file runs quickly.

Set IP steps with the command line (WIN7, set for IPV4):

1. Set up a static IP

netsh interface ipv4 set address name= "Local Area Connection" Source=static addr=192.168.20.11 mask=255.255.255.0 gataway= 192.168.20.1 gwmetric=30

The Gateway Settings section of the black font is optional.

2, set multiple IP, note the difference in red part of the instructions

netsh interface IPv4 set address name= "Local Area Connection" Source=static addr=192.168.20.11 mask=255.255.255.0 gataway= 192.168.20.1gwmetric=30
netsh interface IPv4 add address name= "Local Area Connection" addr=192.168.1.11 mask=255.255.255.0 gwmetric=30
This command sets the 192.168.20.11,192.168.1.11 two IP

3, set up their own active access to IP

netsh interface ipv4 set address name= "Local Area Connection" Source=dhcp

4. Set the domain name
netsh interface ipv4 set DNS name= "Local Area Connection" Source=static addr=202.106.0.20 register=primary

Addr is the domain name server address, primary refers to the primary domain name


Complete sample:

A, office LAN use Beijing-office.bat

netsh interface ipv4 set address name= "Local Area Connection" Source=static addr=192.168.20.11 mask=255.255.255.0 gwmetric=30
netsh interface ipv4 add address name= "Local Area Connection" addr=192.168.1.11 mask=255.255.255.0 gwmetric=30
REM netsh interface ipv4 set DNS name= "Local Area Connection" Source=static addr=202.106.0.20 register=primary


B, the hotel for Internet use, for their own initiative to obtain the IP settings, beijing-hotal.bat

netsh interface ipv4 set address name= "Local Area Connection" Source=dhcp
netsh interface ipv4 set DNS name= "Local Area Connection" Source=static addr=202.106.0.20 register=primary
netsh interface ipv4 add DNS name= "Local Area Connection" addr=202.106.46.151


After creating these two script files, it is very convenient to run the corresponding script file on it only in different environments.


Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

Windows Setup Script IP

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.