Windows batch switching IP address usage

Source: Internet
Author: User
Tags get ip

Do not know whether friends have such an experience, the laptop to the unit when the Internet, because the unit needs to be fixed with the IP address, and the home is automatically get IP address, so every day to this IP address settings to set to go, then there is no simple and convenient way? In fact, we can do a batch process, Each time you want to set the IP address, just run the batch process.

Set IP address batch, save the following code in Notepad as. BAT file, such as: Ipadd.bat, double-click to run.

@echo off

echo Htmer Modify IP Address tool

Echo is setting up your IP address, please wait a moment ...

netsh interface ip set address name= "Local Area Connection" Source=static addr=192.168.0.2 mask=255.255.255.0

netsh interface ip set address name= "Local Area Connection" gateway=192.168.0.1 gwmetric=0

netsh interface ip set DNS name= "Local Area Connection" Source=static addr=192.168.0.3 register=primary

netsh interface ip add DNS name= "Local Area Connection" addr=192.168.0.4

netsh interface ip set wins name= "Local Area Connection" Source=static Addr=none

The above code in the relevant parameters described below, according to your actual situation can be modified:

Addr=192.168.0.2--ip Address

mask=255.255.255.0--Subnet Mask

gateway=192.168.0.1--Gateway

addr=192.168.0.3--Preferred DNS

addr=192.168.0.4--Alternate DNS (if there is no alternate DNS, please delete this line of code)

Second, set up automatic IP address, the following code to save with Notepad. BAT file, such as: Dhcp.bat, double-click to run.

@echo off

echo Htmer Modify IP Address tool

Echo is setting up an automatic IP address, please wait ...

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

netsh interface ip set DNS name= "Local Area Connection" Source=dhcp

Description: The "local link" in the above code is the system default name for the network link in your computer, if you have more than one network card installed, or if you renamed the local link, change the corresponding local link name in the code to your current name.

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.