批处理改DNS的批处理
 
netsh interface ip set dns "本地连接" static 202.103.24.68 primary
netsh interface ip add dns "本地连接" 202.103.44.150
把红色的部分改成你自己的DNS可以添加2个DNS
多个dns
netsh interface ip set dns name="本地连接" source=static addr=1.1.1.1
netsh interface ip add dns name="本地连接" addr=2.2.2.2 index=2
netsh interface ip add dns name="本地连接" addr=3.3.3.3 index=3
@echo off
::判断本地连接 赋值a
for /f "tokens=3,4 delims== " %%i in ('ipconfig ^|findstr /r "本"') do echo %%i %%j >1.txt
for /f "tokens=1 delims==:" %%d in (1.txt) do set a=%%d
::请根据实际情况更改下面三行
echo 开始更改主dns
netsh interface ip set dns name="%a%" source=static addr=202.98.160.68
echo 完成
echo 开始更改副dns
netsh interface ip add dns "%a%" 202.98.161.68 index=2
del 1.txt
exit