批处理修改IP地址和域名(Windows 10)


批处理修改IP地址和域名

批处理文件内容如下:

@echo off

echo Changing the machine's IP address...
netsh interface ipv4 set address name="本地连接" source=static address=10.8.198.220 mask=255.255.255.0 gateway=10.8.198.1

echo Adding Primary DNS server...
netsh interface ipv4 set dns name="本地连接" source=static address=114.114.114.114 register=PRIMARY

echo Adding Backup DNS server...
netsh interface ipv4 add dns name="本地连接" address=223.5.5.5

echo Checking the current configuration...
ipconfig /all

pause
exit

验证网卡的IP和DNS是否设置成功,验证命令:ipconfig /all