How to determine the current network connection status and switch automatically in the cmd command?

windows system, the computer has a fixed network to connect to the company"s internal network, and wifi to connect to the external network.
wants to make a switching device. If the wifi is already connected to the public network, then netsh wlan disconnect
if the wifi is not currently connected to the public network, how can netsh wlan connect name=xxxx
determine whether or not to connect to the public network wifi?

Aug.11,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e46d95-44be0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e46d95-44be0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?