批处理修改dns

请问一下,如何用批处理更改备用DNS,在线等,谢谢
我用了这个命令,可是不行
@echo
netsh interface ip add dns "本地连接1" 221.7.92.98

@echo off
::判断本地连接 赋值a
for /f "tokens=3,4 delims== " %%i in ('ipconfig ^|findstr /r "本"') do echo %%i %%j >DNS.txt
for /f "tokens=1 delims==:" %%d in (DNS.txt) do set a=%%d
::请根据实际情况更改下面三行
echo 开始更改主dns
netsh interface ip set dns name="%a%" source=static addr=219.150.32.132
echo 完成
echo 开始更改副dns
netsh interface ip add dns "%a%" 210.52.149.2 index=2
del DNS.txt
exit

这条批处理本人用过N多网吧,完全可以改
以上是完整修改主副DNS的批处理,你自己可以适当修改DNS
温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-12-30
@echo off
::判断本地连接 赋值a
for /f "tokens=3,4 delims== " %%i in ('ipconfig ^|findstr /r "本"') do echo %%i %%j >DNS.txt
for /f "tokens=1 delims==:" %%d in (DNS.txt) do set a=%%d
::请根据实际情况更改下面三行
echo 开始更改主dns
netsh interface ip set dns name="%a%" source=static addr=219.150.32.132
echo 完成
echo 开始更改副dns
netsh interface ip add dns "%a%" 210.52.149.2 index=2
del DNS.txt
exit
第2个回答  2009-02-27
netsh interface ip add dns name="本地连接1" addr=221.7.92.98 index=2
对了吧?
第3个回答  2009-03-03
你确定你的网络连接里名称是"本地连接1"吗?
相似回答