使用cmd查看电脑连接过的wifi密码(二)

上次写了一个查看wifi的bat文件(https://www.cnblogs.com/feiquan/p/9823402.html),发现有个问题就没法保存到记事本,而且还要处理不同的系统语言,这次重新更新了一下文件。

获取方式:

  1.可直接拷贝代码到记事本后改后缀为bat

  2.百度网盘:      

    链接:https://pan.baidu.com/s/11syCrBvehtpPo7R9cfpk0g

    提取码:8qhn

主要有3个文件:

使用cmd查看电脑连接过的wifi密码(二)

Password是最后密码的存放文件夹,其中的文件是以时间命名的,保证不会覆盖

WiFiPassswordSave.bat 是功能选择界面(直接双击它运行)

seeWiFi.bat :是第一个功能(直接查看wifi密码)

saveWiFi.bat:是第二个功能(保存密码到当前目录下的Password\wifiPassword.txt),如果是直接双击此文件或者不带参数,在输出完成后会自动打开密码所在的文件夹,如果在命令行中输入( saveWiFi.bat  h)加入参数 h,将会定位到密码所在的文件夹,并列出文件目录

提示:这三个bat文件必须要放在同一个文件夹下,如果使用cmd命令可单独调用seeWiFi.bat 和saveWiFi.bat

更新情况:

REM echo UpdataDate:// :
REM echo Version:1.1.1v
REM 修复wifi名为空时,打印不完全
rem 重命名保存的文件名 主机名+用户名+wifiPassword+当前时间
rem 更改临时文件的位置

上代码(可直接拷贝代码到记事本后改后缀为bat):

WiFiPassswordSave.bat

@echo off
if not "%OS%"=="Windows_NT" EXIT
REM if not "%0"=="WiFiPassswordSave.bat" exit
chcp >nul
if "%1"=="back" (
echo ====================================
goto fun
)
Title WiFiPasswordSave
echo WiFiPasswordSave
color
echo ====================================
echo Author:feiquan
echo Create:// :
echo UpdataDate:// :
echo Version:1.1.1v
echo Function:See and Save your computer connnect all WiFi password
REM echo Function:See and Save your computer connnect all WiFi password
REM 修复wifi名为空时,打印不完全
rem 重命名保存的文件名
rem 更改临时文件的位置
REM echo ===================================== rem 删除不需要的文件
if exist "%temp%\userfiles.txt" ( del %temp%\userfiles.txt )
if exist "%temp%\userfiles2.txt" ( del %temp%\userfiles2.txt )
if exist "%temp%\password.txt" (del %temp%\password.txt)
if exist "%temp%\wifiPassword2.txt" ( del %temp%\wifiPassword2.txt ) :fun
rem 选择功能
echo Select function:
echo .See WiFi password
echo .Save all Wifi Password to wifipassword.txt
echo .exit
echo ===================================== set num=
set /p num=请输入你想执行那个功能^(默认:^)^: if %num%== (
rem 功能一:直接查看wifi密码
call seeWiFi.bat ) else if %num%== (
rem 功能二:保存密码到当前目录下的Password\wifi%temp%\password.txt
call saveWiFi.bat ) else (
rem 删除不需要的文件
if exist "%temp%\userfiles.txt" ( del %temp%\userfiles.txt )
if exist "%temp%\userfiles2.txt" ( del %temp%\userfiles2.txt )
if exist "%temp%\password.txt" (del %temp%\password.txt)
if exist "%temp%\wifiPassword2.txt" ( del %temp%\wifiPassword2.txt ) exit
) pause
exit

seeWiFi.bat

@echo off
if not "%OS%"=="Windows_NT" EXIT
if not "%0"=="seeWiFi.bat" exit
chcp >nul
title seeWiFi
REM echo WiFiPasswordSave
REM echo ====================================
REM echo Author:feiquan
REM echo Create:// :
REM echo UpdataDate:// :
REM echo Version:1.1.1v
REM echo Function:See and Save your computer connnect all WiFi password
REM 修复wifi名为空时,打印不完全
rem 重命名保存的文件名
rem 更改临时文件的位置
REM echo ===================================== rem 获取用户配置文件,实时刷新
netsh wlan show profiles |find "All User Profile" >%temp%\userfiles.txt
rem 提取SSID name
powershell -Command "(gc %temp%\userfiles.txt) -replace ' All User Profile : ', ''" >%temp%\userfiles2.txt rem 删除不需要的文件
if exist "%temp%\userfiles.txt" ( del %temp%\userfiles.txt ) rem 功能一:直接查看wifi密码
rem 列出wifi名
echo Your computer connnect all WiFi name:
for /f "tokens=*" %%f in (%temp%\userfiles2.txt) do echo %%f
rem 选择wifi,给name赋值
echo =====================================
:loop
set /p name=Please input your WiFi name(SSID):
( netsh wlan show profiles name="%name%" key=clear |find "SSID name" ) ||echo SSID name : "%name%"
( netsh wlan show profiles name="%name%" key=clear |find "Key Content" ) ||echo Key Content : NO exist
echo =====================================
:continue
set con=y
set /p con=Continue to look up other WiFi password^(默认:y^/n^/q^)^:
if "%con%"=="y" (
goto loop
) else if "%con%"=="n" (
call WiFiPassswordSave.bat back ) else if "%con%"=="q" (
if exist "%temp%\userfiles.txt" ( del %temp%\userfiles.txt )
if exist "%temp%\userfiles2.txt" ( del %temp%\userfiles2.txt )
exit
) else (
goto continue
)
rem 功能一:end

saveWiFi.bat

@echo off
if not "%OS%"=="Windows_NT" EXIT
if not "%0"=="saveWiFi.bat" exit
@echo off
chcp >nul
title saveWiFi
REM echo WiFiPasswordSave
REM echo ====================================
REM echo Author:feiquan
REM echo Create:// :
REM echo UpdataDate:// :
REM echo Version:1.1.1v
REM echo Function:See and Save your computer connnect all WiFi password
REM 修复wifi名为空时,打印不完全
rem 重命名保存的文件名
rem 更改临时文件的位置
REM echo ===================================== echo Starting working .... rem 删除不需要的文件
if "%1"=="h" (
if exist "%temp%\userfiles.txt" ( del %temp%\userfiles.txt )
if exist "%temp%\userfiles2.txt" ( del %temp%\userfiles2.txt )
if exist "%temp%\password.txt" (del %temp%\password.txt)
if exist "%temp%\wifiPassword2.txt" ( del %temp%\wifiPassword2.txt )
) rem 获取用户配置文件,实时刷新
netsh wlan show profiles |find "All User Profile" >%temp%\userfiles.txt
rem 提取SSID name
powershell -Command "(gc %temp%\userfiles.txt) -replace ' All User Profile : ', ''" >%temp%\userfiles2.txt rem 删除不需要的文件
if exist "%temp%\userfiles.txt" ( del %temp%\userfiles.txt ) rem 功能二:保存密码到%temp%\password.txt rem 遍历SSID name
for /F "tokens=*" %%i in (%temp%\userfiles2.txt) do (
echo ==========================================================>>%temp%\password.txt
((netsh wlan show profiles name="%%i" key=clear |find "SSID name")||echo SSID name : "%%i" )>>%temp%\password.txt
((netsh wlan show profiles name="%%i" key=clear |find "Key Content")||echo Key Content : NO exist )>>%temp%\password.txt
) rem 替换关键字
powershell -Command "(gc %temp%\password.txt) -replace 'SSID name', 'Wifi name'" >%temp%\wifiPassword2.txt
set cName=%computername%
set uName=%username%
powershell -Command "(gc %temp%\wifiPassword2.txt) -replace 'Key Content','Password '>%cName%_%uName%_wifiPassword"$(Get-Date -Format 'yyyyMd Hms')".txt" rem 删除不需要的文件
if exist "%temp%\userfiles.txt" ( del %temp%\userfiles.txt )
if exist "%temp%\userfiles2.txt" ( del %temp%\userfiles2.txt )
if exist "%temp%\password.txt" (del %temp%\password.txt)
if exist "%temp%\wifiPassword2.txt" ( del %temp%\wifiPassword2.txt ) rem 移动文件
if not exist Password mkdir Password
move %cName%_%uName%_wifiPassword* .\Password
cd Password if not "%1"=="h" (
start .\
exit
) dir
rem 功能二:end
上一篇:python gensim的第一次试用


下一篇:简单方法解决bootstrap3 modal异步加载只一次的问题