Forgot your home Wi-Fi password and there's no sticker with the connection details on your router? Or do you need to share your network with a guest but don't have time to access the router's settings? In most cases, the Wi-Fi password is already saved on your computer—you can quickly retrieve it using Windows command line (CMD) without installing additional programs.
This method works on all versions Windows 7/8/10/11, if the device has connected to the desired network at least once. The main advantage is that no access to the router's web interface or a physical button is required. WPS. In 90% of cases, administrator rights are also not needed, but there are nuances (we will discuss them below).
In this article we will analyze three ways Getting a password via CMD: from the simplest (for the current network) to the most advanced (for all saved networks). We'll also explain why the command sometimes returns an error and how to fix it.
1. How to find out the password for your current Wi-Fi network (the fastest way)
If your computer currently connected To connect to the network whose password you need to find out, use this command. It will work even without administrator rights.
Open command line:
- 🔍 Click
Win + R, entercmdand clickOK. - 🖱️ Or search through Windows search: type “Command line" and select the classic app (not PowerShell!).
Enter the command:
netsh wlan show interfaces
Find the line in the results SSID — is the name of your network. And then run the second command (replace NETWORK_NAME to the real SSID):
netsh wlan show profile name="NETWORK_NAME" key=clear
In the block Security parameters there will be a line Key content — this is your password. If you see nothing instead of a password, go to the following method.
2. How to extract passwords from all saved Wi-Fi networks
This method will show all networks, to which your PC has ever connected, including passwords. You will need administrator rights (if you don't have them, skip to 3rd method).
Launch the command prompt as administrator:
- 🔎 Click
Win + Xand select "Command Prompt (Administrator)" (or "Windows Terminal (Administrator)» in Windows 11). - 🛡️ If a UAC prompt appears, confirm the action.
Enter the command to list all saved networks:
netsh wlan show profiles
Copy the name of the desired network (column Username) and run:
netsh wlan show profile name="NETWORK_NAME" key=clear | findstr "Key Contents"
If you need to save all passwords to a text file, use:
for /f "tokens=4 delims=:" %a in ('netsh wlan show profiles ^| find "All users"') do @echo %a & netsh wlan show profile name="%a" key=clear | findstr "Key contents" >> WiFi_passwords.txt
File WiFi_passwords.txt will appear in the folder C:\Windows\System32 (move it to a convenient location).
Run CMD as administrator
Make sure the PC has connected to the desired network before
Copy the network name (SSID) without errors
Check the result for the presence of the string "Key Content"
-->
⚠️ Attention: In Windows 11 after the update 22H2 The command may not show the password for networks connected via WPS or Windows HelloIn this case, use PowerShell method.
3. Alternative Method: PowerShell for Modern Windows Versions
If netsh didn't work (for example, in Windows 11 or after resetting network settings), try PowerShellThis method is more reliable for newer operating systems.
Open PowerShell as administrator:
- 🔍 Click
Win + S, enter "PowerShell", right-click and select "Run as administrator». - 📜 Or enter in CMD:
powershell -ep bypass.
Enter the command to display all saved passwords:
(netsh wlan show profiles) | Select-String "\:(.+)$" | %{$name=$_.Matches.Groups[1].Value.Trim(); $_} | %{(netsh wlan show profile name="$name" key=clear)} | Select-String "Key contents\W+\:(.+)$" | %{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | %{[PSCustomObject]@{PROFILE_NAME=$name;PASSWORD=$pass}} | Format-Table -AutoSize
The result will be in the form of a table:
| Network name (SSID) | Password |
|---|---|
| TP-Link_5G | 12345678 |
| MegaFon_Free | (empty) |
| KEENETIC-1234 | qwerty12345 |
If the password is not displayed, it means:
- 🔒 The network was connected via
WPS(without entering a password). - 🗑️ The network profile was deleted after the last connection.
- 🔄 Windows has been updated and the settings have been reset (relevant for Windows 10 20H2+).
Why is PowerShell more reliable than CMD?
PowerShell handles command output more flexibly, especially in modern versions of Windows. For example, it correctly displays Cyrillic characters in passwords and doesn't truncate long SSIDs. Furthermore, PowerShell allows you to export results to CSV for easy storage.
4. What to do if the command does not show the password?
If after running the commands you see an empty line instead of a password or an error "Failed to execute command", check these points:
⚠️ Attention: On laptops Dell And HP With pre-installed Windows, sometimes blocking access to network profiles works through netshIn this case, use third-party utilities (For example, WirelessKeyView) or reset the password through the router.
Common causes and solutions:
| Problem | Solution |
|---|---|
| The command returns "Access denied" | Run CMD/PowerShell as administrator. |
| Instead of a password there is emptiness | The network is connected via WPS or Windows Hello. Try it. netsh wlan export profile folder="C:\" key=clear and open the created XML file. |
| Error: "Profile not found" | Make sure the network name is entered accurately (case-sensitive!). Check the list of profiles with the command netsh wlan show profiles. |
| The command doesn't work in Windows 11. | Use PowerShell or update your system to the latest version (in 23H2 (bug fixed). |
If none of the methods worked, there are two options left:
- 🔧 Reset the password via the router: go to the web interface (usually
192.168.0.1or192.168.1.1) and check your wireless network settings. - 📱 View password on another device: for example, on Android- smartphone with root rights or through
Settings → Wi-Fion MacOS.
5. Security: Who else can see your Wi-Fi passwords?
Saved Wi-Fi passwords are stored in in encrypted form in the Windows registry, but they can be easily extracted using standard tools (as we did above). This means that:
- 🖥️ Any user of your PC with administrator rights can find out all saved passwords.
- 💻 Malicious software (for example, Trojans like WiFiFisher) can steal this data remotely.
- 🔄 At transferring a computer to another person It is recommended to reset network settings:
netsh wlan delete profile name="*".
In Windows 10/11, Wi-Fi passwords are stored in a file C:\ProgramData\Microsoft\Wlansvc\Profiles\Interfaces\{GUID}\{SSID}.xml in encrypted form, but they can be decrypted with SYSTEM rights. To protect yourself:
- 🔐 Use complex passwords (at least 12 characters with letters, numbers and signs).
- 🛡️ Turn it off
WPSon the router - this protocol is vulnerable to brute-force attacks. - 🔄 Update your router firmware regularly (especially for TP-Link, ASUS, Keenetic).
⚠️ Attention: In corporate networks (for example, in offices or universities), passwords are often stored in domain policies. Retrieve them through netsh It won't work - you'll need domain administrator rights.
6. How to save Wi-Fi passwords for future use
To avoid searching for passwords every time, export them into a convenient format. Here are three reliable ways:
Method 1: Export to XML
netsh wlan export profile folder="C:\WiFi_Backup\" key=clear
Files with passwords will appear in the folder C:\WiFi_BackupThey can be imported on another PC using the command:
netsh wlan add profile filename="C:\WiFi_Backup\NETWORK_NAME.xml"
Method 2: Text file with passwords
Create .bat-file with script:
@echo offfor /f "tokens=4 delims=:" %%a in ('netsh wlan show profiles ^| find "All users"') do (
echo Profile: %%a
netsh wlan show profile name="%%a" key=clear | findstr "Key Contents" >> WiFi_passwords.txt
)
pause
Run it as administrator - a file will appear in the folder WiFi_passwords.txt.
Method 3: Cloud Storage
- 🔗 Save the file with passwords in Google Drive or OneDrive (encrypted with an archive with a password).
- 📱 Use password managers (KeePass, 1Password) marked "Wi-Fi".
- 📝 Keep a physical notebook for critical networks (e.g. work).
FAQ: Frequently Asked Questions About Wi-Fi Passwords in Windows
❓ Is it possible to find out the Wi-Fi password without administrator rights?
Yes, but only for current network, to which the PC is connected. Use the command netsh wlan show profile name="NETWORK_NAME" key=clear in a regular CMD. To view all saved networks Administrator rights are required.
❓ Why does the command show the password as dots ()?
This is a bug in older versions of Windows (before 10 1809). Update your system or use PowerShell. Also, check if the option to display passwords as asterisks is enabled in the registry (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System, parameter HideWiFiPassword).
❓ Does this method work on MacOS or Linux?
No, these commands are Windows specific. MacOS passwords are stored in "Keychain" (application Keychain Access). On Linux use:
sudo cat /etc/NetworkManager/system-connections/NETWORK_NAME | grep psk=
Is it possible to find out my neighbors' passwords using CMD?
No. Teams netsh And PowerShell show only those networks to which your computer was connectedSomeone else's Wi-Fi can only be hacked with specialized tools (for example, Aircrack-ng), What illegally and requires deep knowledge.
❓ How do I delete a saved Wi-Fi password from Windows?
Use the command:
netsh wlan delete profile name="NETWORK_NAME"
To remove all saved networks:
netsh wlan delete profile name=*
After this, Windows will ask for a password the next time you connect.