Windows 7: modify the ip dns bat batch processing command

Source: Internet
Author: User

Students who often return to and from the lab will encounter a problem:

A dormitory router generally automatically obtains an ip address,

However, static IP addresses are usually used in the lab.

Every round trip requires modification every day, which is very troublesome.

A simple method is provided here: (This method is for Windows 7, and for Windows xp, see the last line)

Step 1: Create a txt file

Step 2: Add the following content to the file:


Netsh interface ip set address name = "local connection" source = static addr = 10.60.37.99 mask = 255.255.255.0gateway = 10.60.37.254

Netsh interface ip set dns "local connection" source = static addr = 202.120.190.208


The four red parts need to be modified as needed:

10.60.37.99 is an IP address.

255.255.255.0 is the mask address.

10.60.37.254 is the default gateway.

202.120.190.208 is a dns


Step 3: Change the suffix of the txt file from. txt to. cmd.

Step 4: Right-click the. cmd file and select "run as administrator"


Success!

 

PS tutorial:

If you want to go back to the dormitory and want to automatically get the ip address and dns,

You only need to create a new cmd file with the following content:

Netsh interface ip set address name = "local connection" source = dhcp

Netsh interface ip set dns name = "local connection" source = dhcp

 


Commands in xp are slightly different:


Netsh interface ip set address name = "local connection" source = static addr = 10.60.37.96 mask = 255.255.255.0

Netsh interface ip set address name = "local connection" gateway = 10.60.37.254 gwmetric = 0

Netsh interface ip set dns "local connection" source = static addr = 202.120.190.208

Related Article

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.