Quickly modify the IP address of a script under Windows

Multiple user terminals, internal R & D testing or software engineering company involved in travel often involves the issue of host IP address changes each time modifying IP addresses need to open the Network and Sharing Center Change adapter settings, modify the properties of the corresponding IP network connection. Implemented as scripts save time and effort. Proceed as follows:

First, a new text document, paste the following code in Notepad:

1, static IP script:

netsh interface ip set address name = "Local Area Connection" source = static addr = 192.168.1.133 mask = 255.255.255.0 gateway = 192.168.1.1

netsh interface ip set dns name = "Local Area Connection" source = static addr = 192.168.1.1 validate = no

Description:

The first statement, set address is to set the IP address.

name = "Local Area Connection", which refers to the connection with the Internet, according to the network adapter to fill the case.

source = static, static IP setting means

addr the IP address settings

gateway refers to the default gateway

Article 2 of the statement, set dns DNS server address is set.

addr refers to the preferred DNS server

2, dynamic IP script:

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

netsh interface ip set dns name = "Local Area Connection" source = dhcp

Description: This is set to automatically obtain IP

II: Save as .bat

Documents Save As, select the type "all files", the file name .bat to the end, encoding is ANSI.

 

 After saving the file is displayed as follows:

 

 Third, Run as administrator.

After saving the file selected, right.

Click on "Run as administrator"

 

 

Fourth, save if modified, the right file, select "Edit", modified.

 

Guess you like

Origin www.cnblogs.com/thanks0515/p/11447550.html