BAT 设置WIFI代理

编程入门 行业动态 更新时间:2024-10-22 23:00:55

<a href=https://www.elefans.com/category/jswz/34/1760302.html style=BAT 设置WIFI代理"/>

BAT 设置WIFI代理

@echo off
echo waiting
timeout /t 5 > NUL
set "WIFI_PROXY_NAME=*******"
set NIC_num=0

REM 获取当前wifi名
for /f "tokens=1,2,3,* delims=: " %%i in ('netsh WLAN show interfaces') do (
  if %%i==SSID (
  set WIFI_name=%%j)
)
echo %WIFI_name%
REM 判断wifi是否需要代理
if %WIFI_name%==%WIFI_PROXY_NAME% (
  goto setPROXY
  ) else (
  goto cancelPROXY)

:setPROXY
echo **************************************************************************

echo *                                设置代理                            *

echo *                     Windows 10 Copyright (C) 2021-10-08                *

echo **************************************************************************

echo 开始设置proxy代理..........

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 "**.**.**.**:8080" /f 

color 2

echo 已设置代理服务器上网

goto exist

:cancelPROXY
echo **************************************************************************

echo *                                  取消代理                              *

echo *                     Windows 10 Copyright (C) 2021-10-08                *

echo **************************************************************************

echo 开始设置取消proxy代理..........

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 "" /f 

color 2

echo 已取消代理服务器上网

goto exist

:exist

更多推荐

BAT 设置WIFI代理

本文发布于:2024-03-09 09:21:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1724591.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:BAT   WIFI

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!