Using Batch, how to determine whether or not you are connected to a WiFi network?

Using netsh wlan connect name="your network_name" you can request to connect to a WiFi network, but can't be sure whether or not you are connected.

So, in Batch, what would be a command line to check whether or not I am connected to a WiFi network? (The WiFi network may, or may not, have network access.) (it should also work for modile hotspots too.)

If Connected, It should display YES,

If NOT Connected, It should display NO,

because I want to run a loop depending upon the results I get.

So can someone write good working batch program!! or c++(if possible too)
Last edited on
What you could do is simply have the program ping a reliable well known server (eg google) to insure you have a connection, I think this would be simpler than checking with other methods.
Topic archived. No new replies allowed.