使用cmd查看電腦串連過的wifi密碼(二)

來源:互聯網
上載者:User

標籤:command   輸出   input   移動   other   files   命名   span   style   

上次寫了一個查看wifi的bat檔案(https://www.cnblogs.com/feiquan/p/9823402.html),發現有個問題就沒法儲存到記事本,而且還要處理不同的系統語言,這次重新更新了一下檔案。

擷取方式:

  1.可直接拷貝代碼到記事本後改尾碼為bat

  2.百度網盤:

    連結:https://pan.baidu.com/s/1VRSRHA9GLFTt6FcVrpHucw
    提取碼:w3bw

主要有3個檔案:

Password是最後密碼的存放檔案夾,其中的檔案是以時間命名的,保證不會覆蓋

WiFiPassswordSave.bat 是功能選擇介面(直接雙擊它運行)

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

saveWiFi.bat:是第二個功能(儲存密碼到目前的目錄下的Password\wifiPassword.txt),如果是直接雙擊此檔案或者不帶參數,在輸出完成後會自動開啟密碼所在的檔案夾,如果在命令列中輸入( saveWiFi.bat  h)加入參數 h,將會定位到密碼所在的檔案夾,並列出檔案目錄

提示:這三個bat檔案必須要放在同一個檔案夾下,如果使用cmd命令可單獨調用seeWiFi.bat 和saveWiFi.bat

上代碼(可直接拷貝代碼到記事本後改尾碼為bat):

WiFiPassswordSave.bat 

@echo offif not "%OS%"=="Windows_NT" EXITREM if not "%0"=="WiFiPassswordSave.bat" exitchcp 65001if "%1"=="back" (echo ====================================goto fun)echo WiFiPasswordSaveecho ====================================echo Author:feiquanecho Create:2018/10/20 17:39echo UpdataDate:2018/10/21 20:12echo Version:1.1vecho Function:See and Save your computer connnect all WiFi passwordecho =====================================:funrem 選擇功能echo Select function:echo     1.See WiFi passwordecho     2.Save all Wifi Password to wifiPassword.txtecho     3.exitecho =====================================set num=2set /p num=請輸入你想執行那個功能^(預設:2^)^:if %num%==1 (rem 功能一:直接查看wifi密碼call seeWiFi.bat ) else if %num%==2 (rem 功能二:儲存密碼到目前的目錄下的Password\wifiPassword.txtcall saveWiFi.bat ) else (rem 刪除不需要的檔案if exist "userfiles.txt"  ( del userfiles.txt )if exist "userfiles2.txt"  ( del userfiles2.txt )if exist "password.txt"  (del password.txt)if exist "wifiPassword2.txt"  ( del wifiPassword2.txt )exit)pauseexit

 

seeWiFi.bat 

@echo offif not "%OS%"=="Windows_NT" EXITif not "%0"=="seeWiFi.bat" exitchcp 65001REM echo WiFiPasswordSaveREM echo ====================================REM echo Author:feiquanREM echo Create:2018/10/20 17:39REM echo UpdataDate:2018/10/21 20:12REM echo Version:1.1vREM echo Function:See your computer connnect all WiFi passwordREM echo =====================================rem 擷取使用者設定檔,即時重新整理netsh wlan show profiles |find "All User Profile" >userfiles.txtrem 提取SSID name powershell -Command "(gc .\userfiles.txt) -replace ‘    All User Profile     : ‘, ‘‘" >userfiles2.txtrem 刪除不需要的檔案if exist "userfiles.txt"  ( del userfiles.txt )rem 功能一:直接查看wifi密碼rem 列出wifi名echo Your computer connnect all WiFi name:for /F %%f in (userfiles2.txt) do echo        %%frem 選擇wifi,給name賦值echo =====================================:loopset /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 existecho =====================================:continueset temp=yset /p temp=Continue to look up other WiFi password^(預設:y^/n^/q^)^:if "%temp%"=="y" (goto loop) else if "%temp%"=="n" (call WiFiPassswordSave.bat back) else if "%temp%"=="q" (if exist "userfiles.txt"  ( del userfiles.txt )if exist "userfiles2.txt"  ( del userfiles2.txt )exit) else (goto continue)rem 功能一:end

 

saveWiFi.bat

@echo offif not "%OS%"=="Windows_NT" EXITREM if not "%0"=="saveWiFi.bat" exitchcp 65001REM echo WiFiPasswordSaveREM echo ====================================REM echo Author:feiquanREM echo Create:2018/10/20 17:39REM echo UpdataDate:2018/10/21 20:12REM echo Version:1.1vREM echo Function:Save your computer connnect all WiFi passwordREM echo =====================================rem 擷取使用者設定檔,即時重新整理netsh wlan show profiles |find "All User Profile" >userfiles.txtrem 提取SSID name powershell -Command "(gc .\userfiles.txt) -replace ‘    All User Profile     : ‘, ‘‘" >userfiles2.txtrem 刪除不需要的檔案if exist "userfiles.txt"  ( del userfiles.txt )rem 功能二:儲存密碼到目前的目錄下的wifiPassword.txtrem 遍曆SSID namefor /F %%i in (.\userfiles2.txt) do (echo ==========================================================>>password.txt((netsh wlan show profiles name="%%i" key=clear |find "SSID name")||echo     SSID name              : "%%i"  )>>password.txt((netsh wlan show profiles name="%%i" key=clear |find "Key Content")||echo     Key Content            : NO exist )>>password.txt)rem 替換關鍵字powershell -Command "(gc .\password.txt) -replace ‘SSID name‘,  ‘Wifi name‘" >wifiPassword2.txtpowershell -Command "(gc .\wifiPassword2.txt) -replace ‘Key Content‘,‘Password   ‘>wifiPassword"$(Get-Date -Format ‘yyyyMd Hms‘)".txt"rem 刪除不需要的檔案if exist "userfiles.txt"  ( del userfiles.txt )if exist "userfiles2.txt"  ( del userfiles2.txt )if exist "password.txt"  (del password.txt)if exist "wifiPassword2.txt"  ( del wifiPassword2.txt )rem 移動檔案if not exist Password mkdir Password move wifiPassword* .\Passwordcd Passwordif not "%1"=="h" (start .\ exit)dirrem 功能二:end

 

使用cmd查看電腦串連過的wifi密碼(二)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.