@echo off
title 自动设置代理服务器
echo 自动设置代理服务器
echo 正在设置ip地址……
netsh interface ip set address name="本地连接" source=static addr=10.69.128.73 mask=255.255.255.0
echo 正在设置网关地址....
netsh interface ip set address name="本地连接" source=static gateway=10.69.128.1 gwmetric=1
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 "10.69.128.20:80" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "" /f
echo 正在刷新设置……
ipconfig /flushdns
echo 设置完毕,按任意键退出!
pause
注意proxy.bupt.edu.cn:8080地址可自己修改:
@rem 运行此批处理*****
@rem【如果添加了代理就删除,反之没有代理就添加代理】*****
@echo off
title 添加/删除IE代理 &&MODE con COLS=30 LINES=3 &color 2e
setlocal ENABLEDELAYEDEXPANSION
@set uu="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
@for /f "skip=3 tokens=3" %%i in ('reg query %uu% /v ProxyEnable') do (if "%%i"=="0x0" (goto sset) else (goto ddel))
:sset
setlocal ENABLEDELAYEDEXPANSION
set uu="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
reg add %uu% /v ProxyServer /t REG_SZ /d "proxy.bupt.edu.cn:8080" /f >nul
reg add %uu% /v ProxyOverride /t REG_SZ /d "<local>" /f >nul
reg add %uu% /v ProxyEnable /t REG_DWORD /d "1" /f >nul
echo.&echo 添加了代理 &ping -n 2 127.1 >nul &&goto :eof
:ddel
setlocal ENABLEDELAYEDEXPANSION
set uu="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
reg delete %uu% /v ProxyServer /f >nul
reg delete %uu% /v ProxyOverride /f >nul
reg add %uu% /v ProxyEnable /t REG_DWORD /d "0" /f >nul
echo.&echo 代理服务器已经删除完毕! &ping -n 2 127.1 >nul &&goto :eof