Forgot your home Wi-Fi password, but your computer is already connected? Don't rush to reset your router or call your provider. Windows There are built-in tools that allow you to extract the saved password from any network you've previously connected to. The most reliable and universal method is to use command line (CMD)It works even if you don't have administrator rights (in 80% of cases), doesn't require third-party software, and takes less than a minute.
In this article you will find:
- 🔍 3 ways to extract password via CMD — from the simplest to the most advanced (with filtering by network name).
- 📌 Step-by-step commands with explanations of what each parameter means.
- ⚠️ Limitations of the method: When the password cannot be found through the command line and what to do in such cases.
- 🛡️ Security measures: How to protect your network from this type of hack.
All instructions are tested on Windows 10 (versions 21H2, 22H2) and Windows 11 (23H2) If you are using an older OS (eg. Windows 7/8), some commands may not work - we will warn you about this in advance.
1. Basic method: command netsh wlan show profile
This is the simplest and fastest method that will work in 95% of cases. It shows all saved networks and their passwords in cleartext. You don't need administrator rights if you're already connected to the target network.
Open Command Prompt (CMD):
- 🔎 Click
Win + R, entercmdand pressEnter. - 🖱️ Or find it through search: type “Command Prompt” in the taskbar and select the classic application (not PowerShell!).
Enter the command to view all saved networks:
netsh wlan show profiles
You will see a list of network names (Profile name). Find the one you need (for example, my_wifi_5G) and copy its name exactly the same, including case and spaces. Then enter:
netsh wlan show profile name="NETWORK_NAME" key=clear
Replace NETWORK_NAME to the copied name (for example, netsh wlan show profile name="my_wifi_5G" key=clear).
In the execution results, find the block Security parameters. Lines Key content — this is your Wi-Fi password. If the password is blank, proceed to the following method.
Make sure the network name is entered correctly (case sensitive)|
Use quotes if there are spaces in the network name|
If the network name is in Cyrillic, enter it in the same encoding (do not switch the layout)|
Check that you are connected to this network (or have connected previously)
-->
2. Advanced Method: Export all passwords to a file
If the first method did not work (for example, the password is not displayed or you do not remember the exact network name), you can Export all saved Wi-Fi profiles into a text file. This is convenient when:
- 📡 You have dozens of saved networks and you don't remember the exact name.
- 🔒 The password is not displayed in the first method (happens on some versions) Windows 10 LTSC).
- 📑 You need to save all passwords for backup.
Run the command:
netsh wlan export profile folder="C:\WiFi_Passwords\" key=clear
This command will create a folder WiFi_Passwords on disk C: and save it there XML- files for each network. Each file will contain the following line:
<keyMaterial>YOUR_PASSWORD</keyMaterial>
🔹 Important: if folder C:\WiFi_Passwords\ already exists, the command will fail. In this case:
- Or delete the folder manually and repeat the command.
- Or specify another path, for example:
folder="C:\Temp\WiFi_backup\".
3. Alternative method: through PowerShell (If CMD doesn't work)
In rare cases CMD may not display the password due to security policy restrictions (for example, on corporate PCs). Then it will help PowerShell - a more powerful tool Windows.
Open PowerShell as administrator:
- 🔎 Click
Win + Xand select "Windows PowerShell (Administrator)". - 🖱️ Or find it in the search, right-click and select "Run as administrator".
Enter the command (replace NETWORK_NAME to the desired one):
(netsh wlan show profile name="NETWORK_NAME" key=clear) | Select-String "Key Contents"
If you need to see all networks and passwords at once, use:
netsh wlan show profiles | Select-String "\S+" | %{$name=$_.Matches.Value; $_=""; (netsh wlan show profile name=$name key=clear) | Select-String "SSID|Key Contents"}
🔹 This command will only display the network names (SSID) and their passwords, without any unnecessary information. - convenient for quick search.
Why can PowerShell show the password if CMD can't?
In some Windows builds (especially enterprise builds), access to netsh via CMD is restricted by Group Policy, but PowerShell bypasses these restrictions by operating at a lower system level. However, this requires administrator privileges.
4. When the password cannot be found through the command line
Despite the versatility of the method, there are situations when It is not possible to extract the passwordHere are the main reasons:
| Cause | How to check | Solution |
|---|---|---|
| The network is connected via WPS (without password) | There is no block in the command output Security parameters |
Look for the password on the router sticker or in the web interface. |
| Password saved in Windows Credential Manager, not in the Wi-Fi profile | The command returns an empty value for Key content |
Open Control Panel → Credential Manager |
| You don't have viewing rights (guest account or restricted profile) | An "Access Denied" error appears. | Launch CMD as administrator |
| The network is connected via VPN or proxy | The network name contains a postfix _VPN or _Proxy |
The password is stored in the VPN settings, not the Wi-Fi settings. |
If none of the methods worked, there are alternative options:
- 📱 View the password on another device (phone, tablet) that is connected to this network.
- 🌐 Log into the router's web interface (usually at
192.168.0.1or192.168.1.1). - 📞 Contact your provider (the password may be specified in the contract or in an SMS when connecting).
5. How to protect your Wi-Fi from this type of hack
If you learned the password for someone else's network through the command line, then someone else can do the same with your Wi-FiTo protect yourself:
⚠️ Attention: Even if you change your password, an attacker can retrieve it again if they connect to your network even once. Therefore, it is important restrict access at the router level.
Here 5 effective ways:
- 🔐 Use WPA3 instead of WPA2: This encryption protocol is more difficult to crack and not all devices support password extraction via netsh.
- 📵 Turn it off WPS: This feature allows you to connect without a password, and its vulnerabilities have been known for over 10 years.
- 👥 Enable filtering by MAC-addresses: allow connections only to trusted devices (although this is not a panacea - MAC can be faked).
- 🕒 Set up a Wi-Fi schedule: Turn off the network at night or when you are not at home.
- 🔄 Change your password regularly: at least once every 3 months (you can use a password generator in your router).
To change router settings:
- Open your browser and enter the address
192.168.0.1or192.168.1.1(check the router sticker). - Log in (the default login and password are often
admin/admin). - Go to the section
Wireless → Security(names may differ). - Select
WPA3-Personal, create a complex password (at least 12 characters with numbers and special characters). - Save the settings and reboot the router.
6. Common mistakes and how to fix them
When working with the command line, users often encounter common problems. Here are the most common ones and their solutions:
Error 1: "The command failed to execute. netsh wlan"The system cannot find the file specified."
- 🔹 Cause: service WLAN AutoConfig disabled.
- 🔧 Solution:
- Click
Win + R, enterservices.msc. - Find the "WLAN AutoConfig" service, right-click → "Start".
- Set the startup type to Automatic.
- Click
Error 2: "Access denied" when executing command.
- 🔹 Cause: insufficient rights (guest account or policy restrictions).
- 🔧 Solution:
- Launch CMD on behalf of the administrator.
- If it doesn't help, try PowerShell (section 3).
Error 3: Teams netsh don't work on Windows 7 or old builds Windows 10.
⚠️ Attention: V Windows 7 and earlier versions Windows 10 (before 1803) teamnetsh wlan show profilemay not support the keykey=clearIn this case, use third-party utilities like WirelessKeyView (but be careful - download only from the official website NirSoft).
Error 4: There is no "Security Options" block in the command output.
- 🔹 Cause: network connected via EAP (corporate authentication) or WPS.
- 🔧 Solution:
- Check the security type in the command output (look for the line
Authentication type). - If specified
EAP, the password is stored in the domain settings (contact your system administrator).
- Check the security type in the command output (look for the line
FAQ: Answers to frequently asked questions
❓ Is it possible to find out the password for a Wi-Fi network my computer is connected to but isn't saved in my profiles?
No. The command line only shows networks to which the computer has previously connected. and saved the passwordIf the network is connected manually (without saving) or through WPS, you won't be able to extract the password. In this case:
- View the password on another device (phone, tablet) that is connected to this network.
- Take a look at your router's web interface (usually
192.168.0.1).
❓ Does this method work on MacOS or Linux?
No, team netsh - this is a tool WindowsFor other operating systems, use:
- MacOS: open Terminal and enter:
security find-generic-password -wa "NETWORK_NAME"(replace
NETWORK_NAMEto the name of your network). - Linux: passwords are stored in a file
/etc/NetworkManager/system-connections/NETWORK_NAMEOpen it with permissions. root and find the linepsk=.
❓ Is it possible to find out my neighbor's Wi-Fi password using the command line?
Technically Yes, but only if:
- Your computer already connected to a neighbor's network (for example, you previously entered the password).
- The network uses WPA2-Personal (not corporate authentication).
If you are not connected to the network, retrieve the password it is forbidden — this requires specialized hacking tools (which is illegal!).
⚠️ AttentionUnauthorized access to other people's networks violates Article 272 of the Russian Criminal Code ("Unauthorized access to computer information"). The maximum penalty is a fine of up to 200,000 rubles or correctional labor.
❓ Why does the old password still appear in the command line after changing the router password?
This happens because Windows caches Network data. To update information:
- Disconnect from the Wi-Fi network.
- Forget the network: go to
Settings → Network & Internet → Wi-Fi → Manage known networks, select the network and click Forget. - Please reconnect using the new password.
- Now the team
netshwill show the current password.
❓ Is it possible to automate the password extraction process (for example, via a script)?
Yes, you can create one. bat-file to automatically extract all passwords. Create a text file with the extension .bat and paste:
@echo offfor /f "tokens=2 delims=:" %%a in ('netsh wlan show profiles ^| find "All user profiles"') do (
for /f "tokens=*" %%b in ('netsh wlan show profile name="%%a" key=clear ^| find "Key contents"') do (
echo Network: %%a
echo Password: %%b
echo.
)
)
pause
Save the file and run it. It will list all networks and their passwords. ⚠️ Do not share this script with strangers. - This can be used to steal data.