Recently, I brought my laptop back to my place of residence. I went to the company wireless for a while at night. The next day, I found that the IP address of the original wired network card was gone. I had to manually set it once a day. It was really uncomfortable, today I have studied how to solve this problem with batch processing, as shown below:
Step 1: first use ipconfig/all to find the name of the NIC whose IP address is to be set
"Local Connection" in is my wired Nic
Step 2: Open notepad and copy the following statement
Netsh interface IP add address "Local Connection" 192.168.56.194 255.255.255.0
Netsh interface IP Set address "Local Connection" Gateway = 192.168.56.1 gwmetric = 1
Netsh interface IP Set DNS "Local Connection" static 8.8.8.8
Netsh interface IP add DNS "Local Connection" 61.139.2.69 Index = 2
Pause
Change "Local Connection" to the name of the NIC you want to modify, change 192.168.56.194 to the IP address you want to set, and change 255.255.255.0 to the subnet mask you want to set, gateway = 192.168.56.1 gwmetric = 1 -- this is the number of gateway hops. You do not need to change the DNS settings next to it. It can be used nationwide, the last pause line is set to the temporary mode only to view the command execution result. If the execution is successful, delete the pause. Save it as setip. BAT and double-click it when you want to modify the IP address. [If win7 requires an administrator identity]