Windows批处理脚本设置代理

设置代理

@echo off
echo 开始开启系统代理,请稍候...
set PROXY=172.20.10.1:1082

REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %PROXY% /f >nul 2>&1
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f >nul 2>&1

echo 代理已启用: %PROXY%

timeout /t 1 /nobreak >nul

rem echo 请按任意键关闭窗口……
rem pause>nul

关闭代理

@echo off 
echo 正在关闭系统代理,请稍候...

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "" /f >nul 2>&1

echo 系统代理已关闭,请按任意键退出本窗口...

timeout /t 1 /nobreak >nul

rem echo 请按任意键关闭窗口……
rem pause>nul

记得保存为ASNI编码格式

posted @ 2025-03-05 14:43  iZJ"Qq4577105  阅读(150)  评论(0)    收藏  举报