Windows wifi总是自动断开后重连

问题

几分钟 或 十几分钟 wifi就自动断开,然后自动重连。

 

解决方法

  1. 更改电源选项
  2. 更改适配器设置

 

详细方法

  1. 更改电源选项
    1. 打开【控制面板】点击【电源选项】

  1. 修改当前的电源计划设置,点击【更改计划设置】

  1. 点击【更改高级电源设置】

  2. 修改【无线适配器设置】中的【节能模式】,改为【最高性能】。点击【确定】

 

 

  1. 更改适配器设置
    1. 打开【控制面板】,点击【网络和共享中心】

    2. 点击【更改适配器设置】

    3. 选中wifi,右键单击,点击【状态】

    4. 在【WLAN】状态窗口中点击【无线属性】

    5. 在【连接】标签页面中选中【即使网络未广播其名称也连接】

    6. 在【安全】标签页面中点击【高级设置】

    7. 在【高级设置】窗口中选中【为此网络启用联邦信息处理标准兼容】,点击【确定】

可以使用以下批处理代码实现网卡断开wifi自动连接: @echo off setlocal EnableDelayedExpansion set "ssid=your_wifi_ssid" set "password=your_wifi_password" set "profile=%TEMP%\wifi_profile.xml" echo ^<?xml version="1.0" encoding="US-ASCII"?^> > "!profile!" echo ^<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"^> >> "!profile!" echo ^<name^>!ssid!^</name^> >> "!profile!" echo ^<SSIDConfig^> >> "!profile!" echo ^<SSID^> >> "!profile!" echo ^<name^>!ssid!^</name^> >> "!profile!" echo ^</SSID^> >> "!profile!" echo ^</SSIDConfig^> >> "!profile!" echo ^<connectionType^>ESS^</connectionType^> >> "!profile!" echo ^<connectionMode^>manual^</connectionMode^> >> "!profile!" echo ^<MSM^> >> "!profile!" echo ^<security^> >> "!profile!" echo ^<authEncryption^> >> "!profile!" echo ^<authentication^>WPA2PSK^</authentication^> >> "!profile!" echo ^<encryption^>AES^</encryption^> >> "!profile!" echo ^<useOneX^>false^</useOneX^> >> "!profile!" echo ^</authEncryption^> >> "!profile!" echo ^<sharedKey^> >> "!profile!" echo ^<keyType^>passPhrase^</keyType^> >> "!profile!" echo ^<protected^>false^</protected^> >> "!profile!" echo ^<keyMaterial^>!password!^</keyMaterial^> >> "!profile!" echo ^</sharedKey^> >> "!profile!" echo ^</security^> >> "!profile!" echo ^</MSM^> >> "!profile!" echo ^</WLANProfile^> >> "!profile!" netsh wlan add profile filename="!profile!" user=current :retry netsh wlan connect name="!ssid!" >nul ping -n 5 127.0.0.1 >nul set "connected=false" for /f "tokens=2 delims=:" %%a in ('netsh wlan show interface ^| findstr /c:"State"') do ( set "state=%%a" if "!state:~1!"=="not" ( set "connected=false" ) else ( set "connected=true" ) ) if not "!connected!"=="true" goto retry echo Connected to !ssid! pause exit 将代码中的“your_wifi_ssid”和“your_wifi_password”替换为你的WiFi SSID和密码。执行批处理后,它会创建一个WiFi配置文件,并尝试连接到指定的WiFi。如果连接失败,它会重复尝试连接,直到成功连接为止。成功连接后,它将打印“Connected to your_wifi_ssid!”并暂停脚本。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值