Batch file that checks for wifi connection – reconnects if no internet

There is a remote windows PC that has access to “landline” unmetered wifi and there is a Verizon 4G LTE mifi (metered wifi) as backup. This script checks to see if the PC is connected to any wifi, connected to metered wifi, or has any internet connection. It will be called a few times a day by Task Scheduler. Everything seems to work OK while testing at home. Feedback appreciated

@echo off SETLOCAL enabledelayedexpansion  rem get SSID of connected wifi for /f "eol=#tokens=2delims=:" %%a IN ('netsh wlan show interface^|find "SSID                   : "') DO SET wifi=%%a  echo Current wifi is %wifi%  if "%wifi%" == "" (     echo No wifi detected.  Connecting to landline wifi.     netsh wlan connect name="Unmetered Wifi"     timeout /t 10     rem get SSID of connected wifi     for /f "eol=#tokens=2delims=:" %%a IN ('netsh wlan show interface^|find "SSID                   : "') DO SET wifi=%%a     echo Now connected to %wifi% ) else (echo Wifi connected)  rem if connected to metered wifi (contains "Verizon"), switch to landline wifi if not "%wifi%"=="%wifi:Verizon=%" (         echo Metered wifi detected.  Connecting to landline wifi.     netsh wlan connect name="Unmetered Wifi"     timeout /t 10 ) else (echo Wifi connected to landline)   rem if connection failed to landline wifi, fall back to metered wifi ping 8.8.8.8 -n 1 > nul || netsh wlan connect name="Verizon-4GLTE-xxxx"