在 Windows 命令行连接 Wi-Fi

使用 netsh wlan connect 连接到已保存的无线网络,无需点击任务栏图标。

WindowsWLANnetsh 网络配置命令提示符Wi-Fi中风险
运行 `netsh wlan connect name="网络名"`,即可连接到电脑上已保存的 Wi-Fi 网络。

01命令

命令
$ netsh wlan connect name="HomeWiFi"

02作用说明

netsh wlan connect 会使用已存在的无线配置文件发起连接,因此适用于 Windows 已记住密码的网络。先用 `netsh wlan show profiles` 查看确切的配置文件名称。对于从未连接过的网络,需要先用 `netsh wlan add profile` 导入配置文件。

03风险

风险中风险
使用条件The profile must already be saved (see `netsh wlan show profiles`).
!注意: name= 后面填的是已保存的配置文件名,可能与 Wi-Fi 列表里显示的网络名不完全一样。

04撤销

撤销
$ netsh wlan disconnect

05来源

  • netsh
    Microsoft Learn · vendor-doc · 2026-09-17
    依据: 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
    依据: Reference for netsh context commands such as wlan delete profile and winhttp proxy.

最后验证: 2026-09-18 · 分类: 网络

06相关方案