Windows: how to connect/disconnect wi-fi from command-line

(Useful pre-reading: About these papers)

This assumes that you have previously established a wi-fi connection, so windows has created what it calls a “profile”.

In short, the commands are:

1
netsh wlan connect ssid=<ssid> name=<name>

and

1
netsh wlan disconnect

To obtain ssid and name, use:

1
netsh wlan show profile

This should display all existing profile names, and by default, the <name> is the same as the <ssid>.

Things can get more complicated if you have multiple wi-fi adapters, or an ssid that differs from the profile name, but the above should cover the general case.

Last updated on 2025-10-23 Thu 23:00:51 CEST