吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1736|回复: 37
收起左侧

[学习记录] 使用PowerShell查看本机连接过并且已保存的WiFi密码(仅1行代码,全网最简)

  [复制链接]
BLUE7777777 发表于 2023-5-23 01:33
本帖最后由 BLUE7777777 于 2023-5-23 16:16 编辑

https://www.52pojie.cn/forum.php?mod=redirect&goto=findpost&ptid=1788583&pid=46787593
有人提出了高阶压缩套娃法,我也压缩成一行。
[PowerShell] 纯文本查看 复制代码
foreach ($item in (netsh wlan show profile|where{ $_ -match "文件"})){netsh wlan show profile name=($item -replace "    所有用户配置文件 : ","") key=clear|where{ $_ -match "    名称|关键内容"}}






初始代码:
[PowerShell] 纯文本查看 复制代码
$WiFiProfiles=netsh wlan show profile|where{ $_ -match "文件"}
for($i=0;$i -lt $WiFiProfiles.Count;$i++)
{netsh wlan show profile name=($WiFiProfiles[$i] -replace "    所有用户配置文件 : ","") key=clear|where{ $_ -match "    名称|关键内容"}}


测试结果:
一行版
W5.jpg
W6.jpg
W7.jpg
W8.jpg

三行版
W1.png
W2.png
W3.png
W4.png

免费评分

参与人数 6吾爱币 +6 热心值 +4 收起 理由
lcg2014 + 1 + 1 谢谢@Thanks!
aquarz + 1 + 1 我很赞同!
hwh425 + 1 用心讨论,共获提升!
He深渊 + 1 + 1 我很赞同!
xyl52p + 1 谢谢@Thanks!
qq63 + 1 + 1 谢谢@Thanks!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| BLUE7777777 发表于 2023-5-23 11:54
hfxiang 发表于 2023-5-23 11:42
其实cmd下也很精炼,win10下只一行代码就测试通过:
@for /f "skip=10 tokens=1* delims=: " %a in ('nets ...

你硬要非得这样故意压缩,那我也可以压缩成一行啊!
[PowerShell] 纯文本查看 复制代码
foreach ($item in (netsh wlan show profile|where{ $_ -match "文件"})){netsh wlan show profile name=($item -replace "    所有用户配置文件 : ","") key=clear|where{ $_ -match "    名称|关键内容"}}
zhuhuaicheng 发表于 2023-5-23 05:54
andyle 发表于 2023-5-23 07:49
safedragon 发表于 2023-5-23 08:25
感谢楼主分享
liu8833637 发表于 2023-5-23 08:34
感谢楼主分享!
yu520 发表于 2023-5-23 08:38
这个是怎么使用的
海蛎子 发表于 2023-5-23 08:40
感谢分享

mokson 发表于 2023-5-23 08:46
好的,我赶紧试试。
 楼主| BLUE7777777 发表于 2023-5-23 08:47
yu520 发表于 2023-5-23 08:38
这个是怎么使用的

以管理员身份运行PowerShell,复制进去!
wfghim 发表于 2023-5-23 09:01

感谢楼主分享!
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-3-29 13:06

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表