如何检查.cmd(批处理脚本)中的Internet连接,并根据是否连接WiFi来运行另一个命令?

逻辑如下

Setup WiFi Connection
if connection was successful:
     execute command1
else
     execute command2

使用以下命令完成WiFi设置

netsh wlan connect ssid=%ssid% name=%name%

我感兴趣的是如何制定if条件。

wangruiyue 回答:如何检查.cmd(批处理脚本)中的Internet连接,并根据是否连接WiFi来运行另一个命令?

netsh wlan show interfaces | findstr "SSID.*%ssid%"
IF %ERRORLEVEL% EQU 0 GOTO connected
本文链接:https://www.f2er.com/3150542.html

大家都在问