Forgot your home Wi-Fi password and there's no sticker with the connection information on your router? Or do you need to share your network with a guest but can't be bothered to find the router box? Windows Command Prompt (CMD) allows you to quickly retrieve saved passwords from all networks your computer has ever connected to. But before using this method, it's important to understand its limitations and potential risks.
This method only works for networks that your PC has already connected to before - CMD doesn't hack other people's networks. If you're looking for a way to access someone else's Wi-Fi without permission, be warned: this is illegal and carries serious consequences (more on this in the legal section). However, recovering your own password is completely legal and useful.
In this article we will discuss:
- 🔍 How does Wi-Fi password storage work in Windows and where are they stored?
- 💻 Step-by-step instructions with commands for CMD (relevant for Windows 10/11)
- ⚠️ Possible errors and how to fix them
- 🔒 Alternative methods (via PowerShell, router, third-party programs)
- ⚖️ Legal nuances and ethical issues
⚠️ Attention: The methods in this article are intended only for restoring access to your own networks. Using them to hack into other people's networks is illegal (Article 272 of the Russian Criminal Code, "Unauthorized access to computer information") and may result in criminal liability.
1. How Windows stores Wi-Fi passwords and why they can be retrieved
When you first connect to a wireless network, Windows saves its settings - including the password - in a special storage WLAN profilesThis data is encrypted, but it can be decoded using the system's built-in utilities. Here's how it works:
All network profiles are stored in the registry and in configuration files at the following path:
C:\ProgramData\Microsoft\Wlansvc\Profiles\Interfaces\{Interface GUID}
But there is no need to search for them manually - CMD will do it for you. The main thing is that you will need administrator rights, as access to this data is limited.
Interesting fact: even if you removed the network from the list of available connections in Windows, its profile may remain in the system for some time. This means that the password can sometimes be recovered even after "forgetting" the network.
2. Step-by-step instructions: how to find out your password using CMD
To extract the password, follow these steps. Important: You will need a computer that has already connected to the target network.
- Open CMD as administrator
Click
Win + Xand selectTerminal (Administrator)orCommand Prompt (Administrator)If there is no such item, find it CMD via search, right click and selectRun as administrator. - View the list of saved networks
Enter the command:
netsh wlan show profilesFind the name in the answer (
Name of all user profiles) the required network. - Extract the password
Use the command (replace
NETWORK_NAMEto the name of your network):netsh wlan show profile name="NETWORK_NAME" key=clearThe password will be in the section
Security parametersnext toKey content.
Make sure the computer has connected to the network before.
Run CMD as administrator
Check that the network name is correct (case sensitive!)
Do not close CMD until the end of the procedure-->
If the command returned an error Failed to execute command, check:
- 🔹 Is the network name spelled correctly (case-sensitive)?
- 🔹 Is CMD running with administrator rights?
- 🔹 Has this computer been connected to a network before?
3. Common mistakes and their solutions
Even when entering commands correctly, problems can still arise. Here are the most common ones and how to fix them:
| Error | Cause | Solution |
|---|---|---|
Failed to execute command |
No administrator rights | Run CMD as administrator (see step 1) |
Profile "NETWORK_NAME" not found |
There is a typo in the network name or the network is not saved. | Check the name via netsh wlan show profiles |
Field Key content empty |
The password is not saved (for example, connecting via WPS) | Try alternative methods (section 5) |
WLAN AutoConfig service is disabled |
Service disabled WLAN AutoConfig | Turn it on through services.msc |
If you see the message Key content: missing, this means the password was not saved in the system. This can happen if:
- 🔌 The connection was through WPS (button on the router)
- 🖥️ The network profile was manually deleted
- 🔄 Windows was reinstalled after connecting
⚠️ Attention: On some corporate laptops (e.g. with BitLocker or Domain Policy) Access to Wi-Fi passwords may be blocked by security policies. In this case, please contact your network administrator.
4. Alternative methods for password recovery
If CMD If that didn't help, there are other methods. Let's look at their pros and cons:
🔧 Through the router settings
The most reliable way is to access the router's web interface. The address usually looks like this: 192.168.0.1 or 192.168.1.1 (indicated on the router sticker). The default login and password are also there (most often admin/admin).
Find the section in the interface Wireless or Wi-Fi - there will be a field there Password/Key.
📜 Via PowerShell
Analogue CMD, but with a more modern syntax. Commands for extracting the password:
(netsh wlan show profiles) -match ': (.+)$' | %{$name=$_.Split(':')[1].Trim(); netsh wlan show profile name=$name key=clear} | Select-String -Pattern 'Key content'
This command will display passwords everyone saved networks at once.
🛠️ Using third-party programs
Programs like WirelessKeyView (from NirSoft) or WiFi Password Revealer automate the process. They scan system files and display a list of networks with passwords. Minus: Such utilities may be identified by antivirus programs as potentially dangerous (due to access to protected data).
How does WirelessKeyView work?
The program reads and decodes data from the Windows WLAN profile store. It doesn't hack networks, but only extracts saved passwords. Compatible with Windows 7/8/10/11.
5. Legal and ethical aspects
Recovery own Wi-Fi passwords are legal. But what happens if you try to use these methods to access someone else's network?
In Russia, unauthorized access to computer information (including Wi-Fi) is regulated by:
- 📜 Article 272 of the Criminal Code of the Russian Federation - up to 7 years in prison for hacking
- 📜 Article 273 of the Criminal Code of the Russian Federation — for the creation/distribution of malware
- 📜 Article 138 of the Criminal Code of the Russian Federation - violation of the privacy of correspondence (if traffic is intercepted)
Even if you "just connected to your neighbor's open Wi-Fi," it could qualify as unauthorized access, if the network was protected and you bypassed it. Moreover, the network owner only needs to file a police report with the router logs, which will show your MAC address.
⚠️ Attention: Some "hacking" videos on YouTube suggest usingaircrack-ngorWifitefor hacking Wi-Fi. These tools illegal in most countries, including Russia, and their use is punishable by law. Don't risk it!
6. How to protect your Wi-Fi from such attacks
If you're worried that someone might extract your network password (for example, through a guest computer), take these steps:
- 🔐 Use WPA3 instead of WPA2 (if the router supports it)
- 🔄 Change your password regularly (every 3-6 months)
- 📵 Turn off WPS - This protocol is vulnerable to brute-force attacks
- 🖥️ Set up guest network with a separate password for visitors
- 🛡️ Enable filtering by MAC addresses (although this is not a panacea)
It is also useful to turn off broadcast SSID (hide the network name), but this will create inconvenience for legitimate users. It's better to combine several security methods.
7. Frequently Asked Questions (FAQ)
❓ Is it possible to find out the password for a Wi-Fi network I've never connected to?
No, CMD shows only networks that have been connected to this particular computerFor other people's networks, you will need either access to the router or the owner's consent. Hacking into secure networks is illegal.
❓ Does this method work on MacOS or Linux?
No, in macOS And Linux other commands are used:
- 🍎 MacOS:
security find-generic-password -wa "NETWORK_NAME" - 🐧 Linux: passwords are stored in
/etc/NetworkManager/system-connections/
Why do Wi-Fi passwords disappear after resetting Windows?
Reinstalling or resetting the system clears the storage WLAN profilesTo avoid losing passwords, export them in advance using the command:
netsh wlan export profile folder="C:\WiFi_Backup\" key=clear
This will create files .xml with passwords in clear text.
❓ Is it possible to recover a password if the computer is not connected to the network?
Yes, the main thing is that the network profile was previously saved in the system. Connecting to the network at the time of password extraction is not required. However, if the profile was deleted (for example, through netsh wlan delete profile name="NETWORK_NAME"), it will not be possible to restore it.
❓ Is it safe to use third-party password extraction programs?
Programs like WirelessKeyView are safe if downloaded from the developer's official website (NirSoft). However:
- 🔍 Antivirus programs may block them due to access to system data
- 📥 Download only from trusted sources (not torrents!)
- 🛡️ After using, uninstall the program if you don't need it.