- @echo off
- set info=互助互利,支付宝扫码头像,感谢打赏
- rem 有问题,可加QQ956535081及时沟通
- title %info%
- cd /d "%~dp0"
-
- set "name=ABC"
- set "password=12345678"
- set "interface=无线网络连接"
- set dns=202.96.209.133
-
- >"%tmp%\t.t" echo;s=WSH.Arguments(0),h='';for(var i=0;i^<s.length;i++){h+=s.charCodeAt(i).toString(16).toUpperCase()};WSH.echo(h)
- for /f "delims=" %%a in ('cscript -nologo -e:jscript "%tmp%\t.t" "%name%"') do set hex=%%a
-
- (echo;^<?xml version="1.0"?^>
- echo;^<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"^>
- echo; ^<name^>%name%^</name^>
- echo; ^<SSIDConfig^>
- echo; ^<SSID^>
- echo; ^<hex^>%hex%^</hex^>
- echo; ^<name^>%name%^</name^>
- echo; ^</SSID^>
- echo; ^</SSIDConfig^>
- echo; ^<connectionType^>ESS^</connectionType^>
- echo; ^<connectionMode^>auto^</connectionMode^>
- echo; ^<MSM^>
- echo; ^<security^>
- echo; ^<authEncryption^>
- echo; ^<authentication^>WPA2PSK^</authentication^>
- echo; ^<encryption^>AES^</encryption^>
- echo; ^<useOneX^>false^</useOneX^>
- echo; ^</authEncryption^>
- echo; ^<sharedKey^>
- echo; ^<keyType^>passPhrase^</keyType^>
- echo; ^<protected^>true^</protected^>
- echo; ^<keyMaterial^>01000000D08C9DDF0115D1118C7A00C04FC297EB010000002D50025A36DDCA46AFE16082AE4D313F000000000200000000001066000000010000200000007C10841B16DC100F3DA7C884C915567D98CEC783F1737A07F1EB88F905CBFE7C000000000E80000000020000200000003E4D628DAA064E41324471C609E6693692987AF5D4C3FAAA27E5213561168841100000005C4578E848EB838D38E4C37ADCB1FC6B400000005CAB2B2B8983D51B03DA671236D122F988880EDEE1A55503800E187B502FC6A8659D97B3B95AD0CD967C65034A0D574887441511F13F772C2D4173312378454D^</keyMaterial^>
- echo; ^</sharedKey^>
- echo; ^</security^>
- echo; ^</MSM^>
- echo;^</WLANProfile^>)>test.xml
-
- netsh wlan add profile filename="test.xml" interface="%interface%" user=current
- netsh wlan set profileparameter name="%name%" keyMaterial="%password%"
- netsh wlan connect name="%name%"
- netsh interface ip set dns name="%interface%" source=static addr=%dns% register=PRIMARY
- :end
- echo;%info%
- pause
复制代码
|