List available Wifi Networks & change Connection

Cmd Prompt Command to List Available Wifi Networks

To list the available wifi networks in your PC wlan connection, the MS Dos command prompt service ‘netsh’ can be used.

This is applicable if your computer has wifi dongle, wifi unit attached with your motherboard or laptops etc.,

If your pc is connected through a wired connection to a wifi router, this command will not be applicable.

c:\> netsh wlan show networks

Interface name : Wireless Network Connection 1 
There are 2 networks currently visible. 

SSID 1 : wifiprof1
    Network type            : Infrastructure
    Authentication          : XXX/ZZZ-Personal
    Encryption              : XXYY 

SSID 2 : wifiprof2
    Network type            : Infrastructure
    Authentication          : XXX/ZZZ-Personal
    Encryption              : ZZVV 

There are 2 more commands to be discussed, to actually change the network right from the Dos cmd prompt.

MS DOS Command to show Wifi Network Profiles

Dont confuse this with previous command. The previous one listed the available networks.

This command will list the network profiles (Like: network name, password, connection type etc are all stored in a network profile).

We need to get this profile name to actually connect to a network.

C:\> netsh wlan show profile

Profiles on interface Wireless Network Connection 1:

Group policy profiles (read only)
---------------------------------
    <None>

User profiles
-------------
    All User Profile     : wifiprof1
    All User Profile     : wifiprof2
    All User Profile     : wifimblaze1
    All User Profile     : wifimon
    All User Profile     : wifipublic
    All User Profile     : modtethered

You can see all the profiles you have used in the past to connect to a network with this command.

Dos Cmd Change Wifi Connection

This brings us to the last part of the topic. It is the same command here also. netsh wlan.

Important Note: Profile name used in the below command is case sensitive. Incorrect case will give a connection failure notification.

C:\> netsh wlan connect name=wifiprof1

Connection request was completed successfully.

So, we have learned how to list and switch between wifi networks right from a simple MS Dos command prompt command.

Though this is a simple one, this command can be used with in many programming languages like VBA or Python to automatically switch between networks.

Reference: The commands are learned from this link. Refer this page, for more info on netsh command.