Reference:
http://blog.csdn.net/jiangzhanchang/article/details/7063152
http://wenda.haosou.com/q/1378697364060589
Http://blog.sina.com.cn/s/blog_62defbef0101ow9y.html
First, prepare the editor
1, open notepad++;
2, create a blank page;
3, because the encoding method in CMD is ANSI, so set to ANSI encoding
Second, enter the code
@echo off: Turn off EchoEcho----automatically get the IP address batch file from the Garfieldjiang column---Echo-----http://Hi.csdn.net/jiangzhanchang------------------Echo-----changed by Tingpan---------------------------------Echosetting IP address manually, please wait ... netsh interface ipv4 set address"Local Connection"Static172.16.1.165 255.255.255.0 172.16.1.1: The above line addresses are: IP address, subnet mask, default gateway netsh interface ipv4 add address"Local Connection" 192.168.0.165netsh interface ipv4 add address"Local Connection" 192.168.1.165netsh interface ipv4 set dnsservers"Local Connection"Static114.114.114.114Primary: The above row sets the primary DNS server address for the netsh interface IPv4 set dnsservers"Local Connection"Static172.16.1.1: The above line sets the secondary DNS server address: "Local Area Connection" in the above lines of code can be modified to other as needed, such as "Wireless network Connection"if%errorlevel%==0(netsh interface ipv4 show ip)Else(Echo---------------------error has occurred! -----------------&EchoError code:%errorlevel%&EchoRight-click to select "Run with Administrator" &Echo---------------------------------------------------): &represents a line break pause
Third, files saved in bat format
Batch manually set the computer's IP