@echo off
IF (netsh wlan connect ssid="SRM HOSTELS" name="SRM HOSTELS") GOTO foundit
GOTO end
:foundit
cd "C:\Users\SATYAM\My-GitHub-REPOSITORIES\SRM WIFI LOGIN"
python SRM-WiFi-Auto-Login.py
:end
netsh wlan connect ssid="SRM HOSTELS" name="SRM HOSTELS" >nul 2>&1
if errorlevel 1 (
echo not able to connect. Exiting.
goto :eof
)
echo successfully connected to SRM.
echo Auto-login now...
...
First line: try to connect to the WLAN, redirect STDERR and STOUT (all output) to NUL (Nirwana)
Second line: if that failed (no connection), ...
Third to fifth line: ... echo a message and exit.
Sixth line onward: connection was successful, do your auto-login