It is more convenient when several network segments are switched back and forth in the computer room
The first is to look at the name of the network card
ipconfig /all
Like here, ethernet 3 has a space in the middle. Generally, it is safer to copy here
Then start a command prompt (requires administrator privileges) and type directly in the command prompt
It is not recommended to write a .bat file. After I wrote it, it always showed "The syntax of the file name, directory name, or volume label is incorrect."
// 设置网卡为 dhcp
netsh int ip set address name="以太网 3" source=dhcp
// 设置网卡为 192.168.100.1
netsh interface ip set address name="以太网 3" source=static addr=192.168.100.2 mask=255.255.255.0 gateway=192.168.100.1 1