Connect to Wi-Fi from the Windows command line

Start a wireless connection to a saved network profile with netsh wlan connect.

WindowswlannetshcmdWi-FiMedium risk
Run `netsh wlan connect name="NetworkName"` to connect to a Wi-Fi network that is already saved on the PC.

01Command

Command
$ netsh wlan connect name="HomeWiFi"

02What it does

netsh wlan connect starts a connection using an existing wireless profile, so it works for networks whose password Windows already stores. Use `netsh wlan show profiles` to list the exact profile names. For a network that was never joined, import a profile XML with `netsh wlan add profile`.

03Risk

RiskMedium risk
RequirementsThe profile must already be saved (see `netsh wlan show profiles`).
!Warning: The name after name= is the saved profile name, which may differ from the network name shown in the Wi-Fi list.

04Undo

Undo
$ netsh wlan disconnect

05Sources

  • netsh
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Documents netsh WLAN commands including `netsh wlan show profile name=... key=clear` and `netsh wlan delete profile name=...`.
  • Netsh commands - Windows CMD
    SS64 · technical · 2026-09-17
    Evidence: Reference for netsh context commands such as wlan delete profile and winhttp proxy.

Last verified: 2026-09-18 · Category: Network

06Related solutions