Skip to content

Latest commit

 

History

History
155 lines (97 loc) · 7.19 KB

README.md

File metadata and controls

155 lines (97 loc) · 7.19 KB

MIT License image image image maintenance-status Safe

image

Recover Wi-Fi Password Using CMD, Windows PowerShell

This guide will show you how to recover Wi-Fi passwords on a Windows PC using CMD, Windows PowerShell

Reveal Target Wi-Fi Password

First, we must uncover the target Wi-Fi network to display the corresponding password. To accomplish this, launch the Windows Command Prompt window and input the subsequent command to exhibit all Wi-Fi networks that your computer has previously connected to:


netsh wlan show profile

With the Wi-Fi network profiles visible, enter the following command, replacing `WIFI-NAME-PROFILE` (leave the quotes) with the profile for which you want to see the password:
netsh wlan show profile “WIFI-NAME-PROFILE” key=clear

To only show the Wi-Fi password for that target wireless network profile, enter the following command:


netsh wlan show profile “WIFI-NAME-PROFILE” key=clear | findstr “Key Content”

Reveal All Wi-Fi Passwords

The subsequent command will display all saved Wi-Fi networks along with their corresponding Wi-Fi passwords:


for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @if "%j" NEQ "" (echo SSID: %j & netsh wlan show profiles %j key=clear | findstr "Key Content") & echo.

You can also save all of those Wi-Fi network details shown using the command above to a text document using the following command:


(Windows Power Shell)
(netsh wlan show profiles) | Select-String "All User Profile" | ForEach-Object {
    $ssid = $_.Line.Split(':')[1].Trim()
    $profile = (netsh wlan show profile name=$ssid key=clear)
    $passwordLine = $profile | Select-String "Key Content"
    if ($passwordLine -ne $null) {
        $password = $passwordLine.Line.Split(':')[1].Trim()
        "SSID: $ssid`nPassword: $password`n"
    }
} | Out-File -FilePath "$env:USERPROFILE\Desktop\wifipass.txt"


Note: Replace wifipass.txt at the end of the above command to customize the file name which will be generated in the Windows directory you currently reside.


Create a Windows Batch File

You can create a Windows batch file to show all Wi-Fi network passwords or just download the one provided in this repository.

To create a batch file, open a text editor and paste in the following code:

@echo off
setlocal enabledelayedexpansion

for /f "tokens=2 delims=:" %%a in ('netsh wlan show profile ^| findstr ":"') do (
    set "ssid=%%~a"
    call :getpwd "%%ssid:~1%%"
)

echo.
echo Press any key to exit...
pause > nul
exit

:getpwd
set "ssid=%*"

for /f "tokens=2 delims=:" %%i in ('netsh wlan show profile name^="%ssid:"=%" key^=clear ^| findstr /C:"Key Content"') do (
    echo SSID: %ssid% PASS: %%i
)

Save the file with a .bat extension, such as show_wifi_pass.bat. To run the batch file, simply double-click on it.

This batch file will run the command to show all stored Wi-Fi networks and their associated Wi-Fi passwords. It will also pause at the end so you can view the results.


Troubleshooting

If you encounter any issues while following the steps in this guide, here are some troubleshooting tips that may help:

  • Make sure you are running the commands in a Windows Command Prompt window with administrative privileges. To do this, right-click on the Command Prompt icon and select "Run as administrator".

  • If you are having trouble creating or running a batch file, make sure the file has a .bat extension and that you have permission to run it.

If you continue to have issues, please feel free to open an issue in this repository or seek help from online forums or communities.

Additional Resources

If you would like to learn more about managing wireless networks on Windows, here are some additional resources that may be helpful:

These resources provide more detailed information about the netsh command and other tools for managing wireless networks on Windows.


Acknowledgment

We would like to acknowledge and thank the authors and creators of the additional resources listed in this guide. Your work has provided valuable information and guidance for users looking to learn more about managing wireless networks on Windows. This code was developed with help from various online resources, including documentation for the netsh command, Windows Command Line reference, and Wireless networking on Windows. We would like to thank all contributors who have shared their knowledge and expertise with us. Thank you for your contributions to the community.


Contributing

Contributions to this repository are welcome. If you find any issues or have suggestions for improvements, please submit a pull request or open an issue.

We appreciate any contributions, big or small. Thank you for helping to improve this guide!

License

This project is licensed under the MIT License.