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

批处理脚本无法完整显示WiFi密码末尾感叹号的问题求助

批处理脚本无法完整显示WiFi密码末尾感叹号的问题求助

各位大佬好,我是个批处理新手,写了个脚本用来查看之前连接过的WiFi和对应的保存密码,但是发现自家WiFi的密码最后一个感叹号!显示不出来,有没有人能帮我看看哪里出问题了?

我的脚本代码如下:

:main

title WiFi Password Reveal v1.0

echo.

echo Reveal all saved WiFi passwords Batch file script v1.0     
echo.

echo.

:: Get all the profiles

call :get-profiles r

:: For each profile, try to get the password

:main-next-profile

for /f "tokens=1* delims=," %%a in ("%r%") do (

call :get-profile-key "%%a" key

if "!key!" NEQ "" (

echo WiFi: [%%a] Password: [!key!]

)

set r=%%b

)

if "%r%" NEQ "" goto main-next-profile

echo.

pause

goto :eof

:: Get the WiFi key of a given profile

:get-profile-key <1=profile-name> <2=out-profile-key>

setlocal

set result=

FOR /F "usebackq tokens=2 delims=:" %%a in (

`netsh wlan show profile name^="%~1" key^=clear ^| findstr /C:"Key Content"`) DO (

set result=%%a

set result=!result:~1!

)

(

endlocal

set %2=%result%

)

goto :eof

:: Get all network profiles (comma separated) into the result result-variable

:get-profiles <1=result-variable>

setlocal

set result=

FOR /F "usebackq tokens=2 delims=:" %%a in (

`netsh wlan show profiles ^| findstr /C:"All User Profile"`) DO (

set val=%%a

set val=!val:~1!

set result=%!val!,!result!

)

(

endlocal

set %1=%result:~0,-1%

)

goto :eof

问题具体情况:其他WiFi的密码都能正常显示,只有我家WiFi密码最后一位是感叹号!,脚本输出的时候就少了这个符号,有没有办法解决这个问题呀?

备注:内容来源于stack exchange,提问作者Simon Wilson

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.20 09:54:36