由于在公司需要设置IE代理才能上网,回家后需要取消代理,每次都手动设置和取消,很麻烦,想到可以使用bat脚本实现,网上搜索后,参考bat语法,一个可以方便使用的IE代理管理脚本出炉了:

 

  1. @echo off 
  2. CHOICE /C YNC /M "设置代理请按 Y,清除代理请按 N,或者取消请按 C。" 
  3.  
  4. if errorlevel 3 goto end 
  5. if errorlevel 2 goto clearproxy 
  6. if errorlevel 1 goto setproxy 
  7.  
  8. :setproxy 
  9. echo 开始设置IE代理上网  
  10. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f  
  11. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "192.168.0.107:998" /f  
  12. echo 代理设置完成
  13. goto end 
  14.  
  15. :clearproxy 
  16. echo 开始清除IE代理设置  
  17. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f  
  18. echo IE代理清除完成
  19.  
  20. :end 
  21. echo Run Complete... 
  22. pause>nul 

 

 

使用时,copy代码存为bat文件,修改红色代理ip地址部分为你的代理服务器地址,双击运行后,输入y,设置代理,n取消代理,c退出。

此脚本在win7下测试通过。