批处理文件 – 是否可以使用CMD / BAT / VBS更改WiFi托管网络设置?

我试图使用CMD / BAT / VBS更改我的WiFi热点的两个托管网络设置,但我无法做到.

我想要更改的设置:

>身份验证(例如:WPA,WPA2PSK)
>密码(例如:CCMP / AES)

以下代码提供有关托管网络设置的信息:

netsh wlan show hostednetwork

以下代码设置配置文件参数:

netsh wlan set profileparameter

问题是:运行WiFi热点的配置文件名称是什么.
profileparameter要求提供配置文件名称,我不知道.
我已尝试导出配置文件,但它不包含配置文件名称.
导出的配置文件数据位于windows / system32目录中.

有没有办法解决这个问题?

资源:
Netsh Commands for WLAN

最佳答案 尝试使用此代码获取具有管理员权限的profil名称及其密码:

@echo off
Title Get the Wifi Profile Name with its password by Hackoo tested on french machine
cls & color 0A & echo.
Mode con cols=80 lines=5
:::::::::::::::::::::::::::::::::::::::::
:: Automatically check & get admin rights
:::::::::::::::::::::::::::::::::::::::::
Set TmpLogFile=TmpLogkey.txt
Set LogFile=Wifikey_Log.txt
If Exist %TmpLogFile% Del %TmpLogFile%
If Exist %LogFile% Del %LogFile%
REM  --> Check for permissions
Reg query "HKU\S-1-5-19\Environment" >%TmpLogFile% 2>&1
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
Echo.
ECHO                 **************************************
ECHO                  Running Admin shell... Please wait...
ECHO                 **************************************

    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    set params = %*:"=""
    echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /B

:gotAdmin

::::::::::::::::::::::::::::
::START
::::::::::::::::::::::::::::
setlocal enabledelayedexpansion
for /f "tokens=2 delims=:" %%a in ('netsh wlan show int ^|find /i "profil"') do ( set ProfilName=%%a
    Call:Trim "!ProfilName!"
    echo The profile name is : "!ProfilName!"
    echo The profile name is : "!ProfilName!" > %LogFile%
)
pause
Cls 
echo(
echo The password of your Wifi Network is :
Netsh wlan show profiles name="!ProfilName!" key=clear |Find /i "Conten"
(
    echo The password of your Wifi Network is :
    Netsh wlan show profiles name="!ProfilName!" key=clear |Find /i "Conten"
)>>%LogFile%
pause
Start "" %LogFile%
 ::*************************************************************************************
:Trim <String>
(
    echo Wscript.echo Trim("%~1"^)
)>"%~n0.vbs"
for /f "delims=" %%a in ('Cscript /nologo "%~n0.vbs"') do ( set "Profilname=%%a" )
exit /b
::*************************************************************************************
点赞