由于在公司需要设置IE代理才能上网,回家后需要取消代理,每次都手动设置和取消,很麻烦,想到可以使用bat脚本实现,网上搜索后,参考bat语法,一个可以方便使用的IE代理管理脚本出炉了:
- @echo off
- CHOICE /C YNC /M "设置代理请按 Y,清除代理请按 N,或者取消请按 C。"
- if errorlevel 3 goto end
- if errorlevel 2 goto clearproxy
- if errorlevel 1 goto setproxy
- :setproxy
- echo 开始设置IE代理上网
- 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 "192.168.0.107:998" /f
- echo 代理设置完成
- goto end
- :clearproxy
- echo 开始清除IE代理设置
- reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
- echo IE代理清除完成
- :end
- echo Run Complete...
- pause>nul
使用时,copy代码存为bat文件,修改红色代理ip地址部分为你的代理服务器地址,双击运行后,输入y,设置代理,n取消代理,c退出。
此脚本在win7下测试通过。
转载于:https://blog.51cto.com/cuilc/1107093