批处理设置代理及DNS
来自KlniuWiki
1 设置代理
@echo off :menu echo 请选择要使用的代理: echo 1. fg echo 2. wj echo 3. yf echo 4. gapp echo 5. 清空代理服务器 echo 6. exit echo. choice /C:123456 if errorlevel 6 goto END if errorlevel 5 goto clean if errorlevel 4 goto gapp if errorlevel 3 goto yf if errorlevel 2 goto wj if errorlevel 1 goto fg :fg set proxy="127.0.0.1:8580" goto setproxy :wj set proxy="127.0.0.1:9666" goto setproxy :yf set proxy="127.0.0.1:8080" goto setproxy :gapp set proxy="127.0.0.1:8000" goto setproxy :END echo "个" exit :clean echo. echo 正在清空代理服务器设置…… rem reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f rem reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "" /f rem reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d 0 /f echo 代理服务器设置已经清空 echo. echo. goto menu :setproxy title 自动设置代理服务器 echo 自动设置代理服务器 echo 需要以普通用户权限、管理员权限各运行本程序一次 rem echo 正在清空代理服务器设置…… rem reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f rem reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "" /f rem reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d 0 /f rem echo 代理服务器设置已经清空 echo 正在设置代理服务器…… reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d %proxy% /f reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "" /f echo 设置完毕,按任意键退出! pause
2 设置DNS及WINS 网关
echo 正在设置DNS…… netsh interface ip set dns 本地连接 static 110.85.11.99 primary netsh interface ip add dns 本地连接 110.85.11.98 index=2 netsh interface ip add dns 本地连接 110.85.11.97 index=3 echo 正在设置网关…… netsh interface ip set address name="本地连接" gateway=172.16.13.1 gwmetric=auto echo 正在设置WINS…… netsh interface ip set wins 本地连接 static 172.16.13.4 echo 正在刷新设置…… ipconfig /flushdns echo 显示新的设置: ipconfig /all