通过批处理修改DNS的代码(推荐)
批处理改DNS(推荐):
代码如下:
@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=202.96.128.116
echo 完成
echo 开始更改副dns
netsh interface ip add dns "%a%" 202.96.128.86 index=2
del DNS.txt
exit建议再加一个
echo 删除原始DNS
netsh interface ip del dns name="%a%" all
否则原先有DNS的就修改不了啊嘿嘿
相关推荐
localhost0 2020-11-12
jlccwss 2020-09-11
lwplvx 2020-09-07
YzhilongY 2020-08-31
KevinXC 2020-08-12
oLeiShen 2020-08-01
dahege 2020-08-01
windzoone 2020-07-29
travelinrain 2020-07-27
hxf0 2020-07-10
oLeiShen 2020-06-25
oLeiShen 2020-06-25
dahege 2020-06-25
dahege 2020-06-22
MissFuTT 2020-06-21
ationwork 2020-06-16
kenson 2020-06-12
chwzmx 2020-06-09