标题: [网络连接] 使用bat添加一个未连接过的无线网络 [打印本页]
作者: 曰曰曰 时间: 2021-8-26 14:29 标题: 使用bat添加一个未连接过的无线网络
因为工作需要测试主机,每个主机都要连接一个固定无线做测试,有没有办法能够使用bat命令进行连接?
作者: idwma 时间: 2021-8-27 17:42
- @echo off
- (for /f "delims=" %%a in (%~fs0) do (
- if "%%a"=="<?xml version="1.0"?>" set f=1
- if defined f echo;%%a
- ))>"%~fs0.xml"
- netsh wlan add profile filename="%~fs0.xml"
- netsh wlan connect name="无线名CMCC-10086"
- del "%~fs0.xml"
- pause
- goto :eof
-
-
- <?xml version="1.0"?>
- <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
- <name>MY_NETWORK_SSID</name>
- <SSIDConfig>
- <SSID>
- <name>无线名CMCC-10086</name>
- </SSID>
- </SSIDConfig>
- <connectionType>ESS</connectionType>
- <connectionMode>auto</connectionMode>
- <MSM>
- <security>
- <authEncryption>
- <authentication>WPA2PSK</authentication>
- <encryption>AES</encryption>
- <useOneX>false</useOneX>
- </authEncryption>
- <sharedKey>
- <keyType>passPhrase</keyType>
- <protected>false</protected>
- <keyMaterial>密码</keyMaterial>
- </sharedKey>
- </security>
- </MSM>
- <MacRandomization xmlns="http://www.microsoft.com/networking/WLAN/profile/v3">
- <enableRandomization>false</enableRandomization>
- </MacRandomization>
- </WLANProfile>
复制代码
作者: 曰曰曰 时间: 2021-9-16 16:34
回复 2# idwma
谢谢大佬!
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |