现在,我有2个批次文件,使用注册表编辑器打开和关闭代理
喜欢
reg add "HKCUSoftwareMicrosoftWindowsCurrentVersionInternet Settings" ^
/v ProxyEnable /t REG_DWORD /d 0 /f
但是,我阅读了一些可以根据您已连接的网络打开或关闭代理的地方?因此,如果我能获得SSID名称,如果其他Condtion
简单地获得SSID
做:
netsh wlan show interface | findstr /i "SSID"
将第一个设置为变量a的循环a(假设您不想使用MAC地址):
@echo off
for /f "tokens=3" %%i in ('netsh wlan show interface ^| findstr /i "SSID"') do set "myssid=%%i" & goto next
:next
set "myssid=%myssid: =%"
if /i "%myssid%"=="Spektrum" (
reg add ....
)
if /i "%myssid%"=="someotherSSID" (
reg add ....
)
按原样完成您的代码:
@echo off
for /f "tokens=3" %%i in ('netsh wlan show interface ^| findstr /i "SSID"') do set "myssid=%%i" & goto next
:next
echo %myssid%
set "myssid=%myssid: =%"
echo %myssid%
if /i "%myssid%"=="Spectrum" (
echo "Spectrum"
) ELSE (
echo "Other"
)