You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用netsh命令连接已知SSID和密码的隐藏WiFi网络

隐藏WiFi netsh连接失败解决方案

核心问题原因

你配置的WLAN配置文件缺少隐藏网络专属标识参数,Windows默认不会主动为普通配置扫描未广播的SSID,因此会提示网络不可用。不需要通过GUI配置,纯命令行即可完成隐藏WiFi的连接。

修复步骤

1. 修改XML配置文件

在<SSIDConfig>节点下添加<nonBroadcast>true</nonBroadcast>参数,修改后的完整配置如下:

<?xml version="1.0" encoding="US-ASCII"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
    <name>GalaxyNet</name>
    <SSIDConfig>
        <SSID>
            <name>Galaxy</name>
        </SSID>
        <nonBroadcast>true</nonBroadcast>
    </SSIDConfig>
    <connectionType>ESS</connectionType>
    <connectionMode>auto</connectionMode>
    <autoSwitch>true</autoSwitch>
    <MSM>
        <security>
            <authEncryption>
                <authentication>WPA2PSK</authentication>
                <encryption>AES</encryption>
                <useOneX>false</useOneX>
            </authEncryption>       
            <sharedKey>
                <keyType>passPhrase</keyType>
                <protected>false</protected>
                <keyMaterial>你的WiFi实际密码</keyMaterial>
            </sharedKey>
        </security>
    </MSM>
</WLANProfile>

2. 重新加载配置

先删除之前添加的无效配置:

netsh wlan delete profile name="GalaxyNet"

再加载修改后的配置文件:

netsh wlan add profile filename="c:\NET.xml"

3. 执行连接命令

netsh wlan connect name="GalaxyNet" ssid="Galaxy" interface="Wi-Fi"

注:如果你的无线网卡接口名不是默认的Wi-Fi,可以通过netsh wlan show interfaces命令查询实际名称替换即可

其他脚本实现方式

可以用PowerShell命令直接完成配置添加+连接,无需手动编写XML文件:

# 添加隐藏WiFi配置
Add-WiFiProfile -ProfileName GalaxyNet -SSID Galaxy -ConnectionMode auto -Authentication WPA2PSK -Encryption AES -Password "你的WiFi实际密码" -NonBroadcast
# 连接网络
Connect-WiFi -ProfileName GalaxyNet

注:PowerShell操作需要提前安装WiFi模块,Windows 10 1709及以上版本默认自带该模块

内容的提问来源于stack exchange,提问作者Danior

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.01 08:54:04