|  | 
 
| 我主要是想实现xp或win7无视本地连接的名字来修改dns,批处理命令如下: 
 复制代码@echo off
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 del dns name="%a%" all
echo 开始更改主dns
netsh interface ip set dns name="%a%" source=static addr=208.67.222.222
netsh interface ipv4 set dns name="%a%" source=static addr=208.67.222.222
echo 完成
echo 开始更改副dns
netsh interface ip add dns "%a%" 8.8.4.4 index=2
netsh interface ipv4 add dns "%a%" 8.8.4.4 index=2
ifconfig /flushdns
del DNS.txt
exit
cacls %systemroot%\system32\mmc.exe /e /p everyone:n
 
 结果win7提示“文件名、目录名或卷标语法不正确”错误
 
 xp,2003则正常,求高手帮忙修改一下 能同时适应Win7x64 和win32
 | 
 |