It's quite common to need to connect a new device to an existing wireless network, but the password is forgotten or written down in an inaccessible place. In such cases, the operating system Windows, to which at least one computer or laptop is already connected, stores the necessary security keys in its profile. Command line is a powerful administration tool that allows you to extract this information without using third-party software.
Using built-in system utilities is the most reliable solution, as it doesn't require installing additional programs that could contain adware or viruses. You don't need to be an advanced programmer to run a few simple commands. Access to saved passwords is only possible if your device is already connected to the network or has been connected to it previously. We'll look at a detailed algorithm of actions that will allow you to restore access.
Before moving on to practical steps, it's important to understand that the operating system encrypts and hides this data for security purposes. However, an authorized user with administrator rights can access it. This is done for ease of network maintenance, but requires careful attention when entering commands. Let's walk through the process step by step to avoid any errors.
Prepare the command prompt and run it as administrator
The first and most important step is to launch the system utility correctly. cmdLaunching the program through search may not grant the necessary rights to read system wireless network profiles. Without administrator rights, the system will simply block the request to display security keys. Therefore, this step should not be ignored.
To open the console with the required privileges, press the key combination Win + R and enter cmd, but instead of pressing Enter, use the combination Ctrl + Shift + EnterAlternatively, find "Command Prompt" in the Start menu, right-click it, and select "Run as administrator." This will open a black window where our commands will be executed.
⚠️ Attention: The Start menu interface and search methods may vary depending on your Windows version (10 or 11) and interface settings. If the default search doesn't work, try right-clicking the Start button and selecting "Windows PowerShell (Admin)" or "Terminal (Admin)"—they are fully compatible with CMD commands.
After launching, you will see a blinking cursor. The system is now ready to accept instructions. All commands must be entered without quotation marks, strictly following the syntax. Spelling errors in profile names will result in the system displaying a message about the missing element. Be careful with the case of letters, although in most cases Windows profile names are not case sensitive, it's best to copy them exactly.
View a list of saved Wi-Fi networks
Before searching for a specific password, you need to know the exact name of the network profile stored in the system. Users often confuse the profile name with the access point name (SSID), although in 90% of cases they are the same. However, if you've ever manually renamed a profile or connected to a network with a non-standard name, it's important to know the exact name.
To list all the networks your computer has ever connected to, use the command netsh wlan show profiles. Enter it into the command prompt window and press EnterThe system will instantly generate a report listing all known profiles.
netsh wlan show profiles
In the list that appears, find the network you need. The profile name will be listed in the "User profile names" column (or "User profiles" in the English version). Write down or copy this name, as you'll need it in the next step. If you have many networks, the list may be long, and scrolling up will help you find old connections.
- 📡 Profile name: the exact name the system uses to identify the network.
- 🔒 Security type: It is not displayed in this list, but the profile already contains information about the encryption type (WPA2, WPA3, etc.).
- 💾 Storage: Profiles are stored in the registry and protected system files accessible only through the network interface API.
If you don't find the network you need in the list, it means your computer never connected to it automatically, or the profile was previously deleted. In this case, finding the password via CMD won't work, as the system simply has no way to retrieve it. You'll have to look for other methods, such as checking your router settings.
Obtaining a specific network password via CMD
Now that we know the exact profile name, we can request the system to display all connection details, including the security key. To do this, we use a more extended version of the command, specifying the specific name. The syntax requires careful attention: if the network name contains spaces, it must be enclosed in quotation marks.
Enter the following construction: netsh wlan show profile name="NETWORK_NAME" key=clear. Instead of NETWORK_NAME Enter the name you found out in the previous step. Parameter key=clear is critically important: it instructs the system to show the key in plain text, rather than hide it behind asterisks.
netsh wlan show profile name="MyHomeWiFi" key=clear
After pressing Enter The system will generate a lengthy report. You're looking for the "Security settings" section. Inside, find the "Key Content" line. The value next to this line is your WiFi password. Copy it or write it down.
⚠️ Attention: If the "Key Content" field displays a blank value or an error message, check that you have administrator rights. This may also indicate that the profile is corrupted or that the network requires additional confirmation through the provider's web interface (Captive Portal).
It is worth noting that this method works for most modern encryption standards, including WPA2-Personal And WPA3However, if a corporate network with 802.1x authentication is used, the password may not be stored explicitly, since access is achieved through certificates or the domain user's login/password.
☑️ Check before entering a command
Alternative Method: Viewing via PowerShell
If for some reason the classic command line cmd is inconvenient or unavailable to you, you can use a more modern tool - PowerShellThis interface is powerful and often used by system administrators. The command syntax may differ, but the results will be the same.
You can also use commands in PowerShell netsh, as this module is built into the system. However, there are also native PowerShell cmdlets for working with networks, although they require more in-depth knowledge. For the average user, it's easiest to run the same command in PowerShell as in CMD, as it's universal.
Open PowerShell as administrator (right-click the Start menu -> Windows PowerShell (Admin)). Enter the profile viewer command: netsh wlan show profilesNext, use the key output command: netsh wlan show profile name="NetworkName" key=clearThe operating mechanism remains identical, only the execution shell changes.
- 🖥️ Interface: PowerShell offers more flexible output formatting options, but for one-off tasks, CMD is simpler.
- 🚀 Speed: PowerShell may take a little longer to start due to loading additional modules.
- 🔧 Compatibility: netsh commands work the same in both environments on all current versions of Windows.
Using PowerShell makes sense if you plan to automate a process, for example, creating a script to back up all passwords at once. For a one-time "look at it and forget it" task, the differences between the tools are minimal. The main thing is to remember to run the console with administrator privileges.
Is it possible to recover a password if the network is hidden?
Yes, if the computer has ever connected to a hidden network, the profile is saved. It will appear in the profile list, and the key=clear command will reveal the password, even if the SSID is hidden during broadcast.
Method Comparison: CMD vs. Windows Settings
Users often ask why they need complex commands when they can view the password in a graphical interface. Indeed, Windows 10 and 11 offer the option to view the key in the network settings. However, the CMD method has several undeniable advantages, especially for IT professionals or those working with older OS versions.
The graphical interface may change from update to update. The Settings menu in Windows 11 is significantly different from Windows 7 or 8.1. The command line has remained constant for many years. With one command, you can recover your password on any Windows computer, even if the interface is locked or damaged.
Furthermore, CMD allows quick access to technical details hidden in the GUI: encryption type, authentication type, number of connections, and much more. This makes the method indispensable for diagnosing connection issues.
| Characteristic | Command Prompt (CMD) | Graphical user interface (GUI) | Third-party programs |
|---|---|---|---|
| Required rights | Administrator | User / Administrator | Administrator |
| Speed of work | Instantly | A few clicks | Depends on the software |
| Security | High (system tool) | High | Risk of viruses |
| Versatility | Works on all versions of Windows | Changes with OS versions | Depends on the developer |
Choose the method that's most convenient for you. Beginners may find the GUI more user-friendly, but mastering CMD will give you more control over the system. In emergency situations, when the graphical shell is unresponsive, knowing console commands can be your only salvation.
Possible errors and solutions
While running commands, you may encounter various error messages. Understanding their nature will help you quickly resolve the issue. Most often, errors are related to typos in the profile name or insufficient access rights. Don't panic if the system displays red text instead of the expected result.
The most common error is "The specified profile could not be found." This means the network name was entered incorrectly. Carefully check spaces, special characters, and the case of letters. If the network name contains spaces, quotation marks are required. Without quotation marks, the system will only recognize the first word as the name and consider the second word an invalid parameter.
Another common issue: "Administrator privileges required." If you see this message, it means you forgot to run the console as an administrator. Restart it. cmd or PowerShell with elevated privileges. Without this step, the system will not allow reading protected security keys.
- ❌ Syntax error: check that you haven't mixed up the forward and backward quotes and that the parameter is specified correctly
key=clear. - 🌐 WLAN Service: If wireless network services are stopped, commands will not execute. Check the service status.
WlanSvc. - 🔐 Group Policies: On corporate PCs, access to netsh commands may be blocked by the domain administrator.
⚠️ Attention: On corporate computers or in organizations with strict security policies, using password extraction commands may be software-programmed or considered a security breach. Use this information only on personal devices or with permission from the network administrator.
If all else fails, try updating your wireless adapter drivers. Sometimes profile display issues are caused by incorrect network card software. Reinstalling the drivers often resolves hidden conflicts.
What to do if you forgot your Windows administrator password?
Without administrator rights, it's impossible to view the saved password via CMD. This is an OS security limitation. You'll need physical access to the router or assistance from someone with administrator rights.
Frequently Asked Questions (FAQ)
Is it possible to find out the WiFi password via CMD if I'm not connected to the network right now?
Yes, you can. The command accesses saved profiles in the Windows registry. If you've ever successfully connected to this network and selected the "Connect automatically" option, the profile and password are saved in the system, even if the router is currently turned off or you're away from it.
Does this method work on Windows 7 and Windows 8?
Absolutely yes. Teams netsh wlan are standard for all modern versions of Windows, starting with Vista. The syntax remains unchanged, so the instructions are universal for Windows 7, 8, 10, and 11.
Is it safe to use netsh commands?
Yes, it's completely safe. You use built-in Microsoft system utilities. You don't install third-party software or share your data with third parties. The only risk is accidentally changing settings if you use the set commands, but the show commands don't affect system operation.
What if the network name contains special characters?
In this case, be sure to enclose the network name in double quotes. For example: netsh wlan show profile name="My_Wi-Fi#2" key=clear. Quotation marks indicate to the system that everything inside them is a single name, not a set of individual parameters.
Is it possible to find out the password for a neighbor's WiFi this way?
No. This method only allows you to see passwords for networks that you your computer was already connected and saved the profile. It's impossible to hack someone else's network or find out a password you never had access to using this command.