美文网首页
bat文件修改电脑DNS

bat文件修改电脑DNS

作者: 釠觋 | 来源:发表于2022-08-14 17:39 被阅读0次
@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

      本文链接:https://www.haomeiwen.com/subject/cedlgrtx.html