I. Modify the IP settings
The first step is to change the IP address under the TCP/IP protocol in the local connection. This problem is easy to solve by using the netsh interface ip command. The command is described as follows:
? -Display command list
Add-add a configuration item to the table
Delete-delete a configuration item from the table
Dump-display a configuration script
Help-display command list
Reset-reset TCP/IP and related components to a clean state
Set-set configuration information
Show-display information
Here we only use the set command
For example, netsh interface ip set address "Local Connection" static 172.30.40.59 255.255.0.0 172.30.3.21 1
The names on some machines are not local connections, but local addresses. You only need to replace the relevant content in the above command. The three IP addresses correspond to the IP address, mask, and gateway respectively, the last "1" refers to the number of hops of the default gateway, which is generally "1 ".
1. to switch the static address of the specified adapter to a DHCP address, type the following command: netsh interface ip set address "Local Connection" dhcp
2. Change DNS to 192.168.0.1: netsh interface ip set DNS "Local Connection" static 192.168.0.1
Modify the ip address of a group table: (total code)
@ ECHO off
Reg add HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet001 \ Services \ Tcpip \ Parameters \ Interfaces \ {Parameters}/v IPAddress/t REG_multi_SZ/d 172.30.41.58/f
Reg add HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet001 \ Services \ Tcpip \ Parameters \ Interfaces \ {Parameters}/v SubnetMask/t REG_multi_SZ/d 255.255.0.0/f
Reg add HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet001 \ Services \ Tcpip \ Parameters \ Interfaces \ {Parameters}/v DefaultGateway/t REG_multi_SZ/d 172.30.4.21/f
Reg add HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Class \ {4D36E972-E325-11CE-BFC1-08002bE10318 }\ 0008/v NetworkAddress/d 00E018DEEDBA
Devcon disable * DEV_0057 *
Devcon enable * DEV_0057 *
Copy the above Code to a text file and save it as *. bat, which is a batch file. You can double-click it later. The speed is very fast! (You can also try to write a batch for restoring to the original ip/mac. You only need to change reg add to reg delete in the last sentence and remove the last mac value)