bat文件修改电脑DNS

@echo off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"

::网络适配器名字
set name=WLAN
::网关
set mask=255.255.255.0

::电信 DNS
::set dns_first=61.134.1.4
::set dns_second=218.30.19.40

::114 DNS
::set dns_first=114.114.114.114
::set dns_second=114.114.115.115

::腾讯 DNS
::set dns_first=119.29.29.29
::set dns_second=182.254.116.116

::阿里 DNS
set dns_first=223.5.5.5
set dns_second=223.6.6.6

::百度 DNS
::set dns_first=180.76.76.76
::set dns_second=180.76.76.76

netsh interface ipv4 set dns name=%name% source=static addr=%dns_first% register=PRIMARY

netsh interface ipv4 add dns name=%name% addr=%dns_second% index=2

ipconfig /all

::不关闭窗口
::pause
::退出
exit

你可能感兴趣的:(bat文件修改电脑DNS)