for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @echo %j | findstr -i -v echo | netsh wlan show profiles %j key=clear | findstr /ilc:"关键内容"
复制代码
作者: 610644034 时间: 2023-8-24 19:47
'vsb文件: 获取电脑上网卡链接过的所有WiFi的密码.vbs
Function GetOutput(command)
Set Shell = Wscript.CreateObject("WScript.Shell")
Set cmd = Shell.Exec("cmd /c " & command)
strOut = ""
Do While Not cmd.StdOut.AtEndOfStream
strOut = strOut & cmd.StdOut.ReadLine() & "\n"
Loop
GetOutput=strOut
End Function
Function saveIt(wifi, passwd)
wifi = Replace(Replace(wifi, ">", "-"), "<", "-")
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objFile=objFSO.CreateTextFile(wifi & ".txt")
objFile.Write(passwd)
objFile.Close
End Function
strText=Split(GetOutput("netsh wlan show profile"), "\n")
i = 0
For Each x in strText
If i > 9 And i < Ubound(strText)-1 Then
Name = Split(x, ": ")(1)
str=Split(GetOutput("netsh wlan show profile """ & Name & """ key=clear"), "\n")(29)
passwd = Split(str, ": ")
If Ubound(passwd) Then
saveIt Name, passwd(1)
End If
End If
i = i + 1
Next 作者: skywalkerl 时间: 2023-8-25 13:06
赞,学到了~作者: 此生有求 时间: 2023-9-21 15:24
for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do cls&echo WiFi名称:%j&echo.&netsh wlan show profiles %j key=clear | findstr /ilc:"关键内容"