使用.bat文件设置IE代理服务器和自动配置脚本

时间:2024-03-17 14:26:24

使用代理服务器(每间隔300秒重复执行一次)

@echo off
:start

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.XXX.XXX.22:8080" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /d "" /f

choice /t 300 /d y /n >nul

goto start


使用自动配置脚本,禁用代理服务器

@echo off
color 0a
title Use autoconfig script
echo Starting......
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "10.XXX.XXX.22:8080" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /d "http://pac.XXXX.com/pac/proxy.pac" /f

@echo off


隐藏执行

新建一个.vbe文件,用来执行.bat文件,内容如下:

set ws=wscript.createobject("wscript.shell")
ws.run "Proxy.bat /start",0