It's common to need to connect a new device to a wireless network but lose or forget the password. Fortunately, the operating system Windows Stores access keys to previously used networks in encrypted form, allowing you to restore them without reinstalling drivers or resetting the router. command line is the fastest and most reliable method for administrators and advanced users.
Unlike the GUI, which may hide characters with asterisks, console utilities provide access to the full password text in clear text. This is especially relevant when you need to copy a complex combination of characters for input on a device without a keyboard, for example, on Smart TV or a game console.
To perform the steps below, you will need permissions administrator On a computer that's already connected to the desired network or has previously connected to it. We'll cover native Windows tools that don't require third-party software, ensuring security and a virus-free environment. Let's take a closer look at the process.
Before you can enter commands, you need to properly launch the console. Simply opening the Run window may not be enough to gain full access to system profiles. Press the key combination Win + X and select "Windows PowerShell (Administrator)" or "Command Prompt (Administrator)." In some versions of the operating system, you can simply search for "cmd," right-click, and select "Run as administrator."
Launch Command Prompt with Administrator Privileges
Without elevated privileges (administrator rights), the system blocks access to stored security keys to protect user data. If you attempt to run commands without these privileges, the system will return an access error or display an empty list. Make sure the console window title says "Administrator: Command Prompt."
An alternative way to launch is through the Start menu. Type in the search box cmdWait for the "Command Prompt" result to appear. Don't launch the program immediately; instead, right-click it or select "Run as administrator" in the right pane. This is a critical step for successful execution of subsequent operations.
⚠️ Attention: If you don't have administrator rights on the computer (for example, on a corporate network or on someone else's PC), you won't be able to find the password using this method. Windows system security policies block standard users from reading Wi-Fi profiles.
Once the black window with the cursor successfully launches, you're ready to enter commands. The command line interface may seem intimidating to beginners, but it's a powerful management tool. operating systemAll commands we will use are standard and system-safe.
View a list of saved Wi-Fi networks
The first step is to get a list of all wireless networks your computer has ever connected to. Windows stores profiles of these networks, even if you're far from the access point. To display this list, use the utility netsh (Network Shell), which is a standard component of Windows.
Enter the following command in the window that opens and press the key Enter:
netsh wlan show profiles
After executing the command, the system will display the "User Profiles" section. It will list all saved network names (SSIDs). Please note that some names may be hidden or display incorrectly if special characters were used, but in most cases, the list is legible.
If the list is empty, this means that no Wi-Fi passwords have ever been saved on this computer, or the profile was previously deleted. In this case, this method is not possible to recover the password, and you will need access to the router itself or another device where the password is saved.
Display the password of a specific network in clear text
Knowing the exact network name (SSID) you obtained in the previous step, you can request the saved security key to be displayed. The command requires the profile name to be enclosed in quotation marks if it contains spaces. The command syntax is as follows:
netsh wlan show profile name="Network_Name" key=clear
Parameter key=clear This parameter is key: it tells the system not to hide the password characters, but to display them in the "Key Content" field. Without this parameter, you'll only see the network's technical characteristics, such as the encryption type and channel, but the password itself will remain hidden.
In the command output, scroll down to the "Security settings" section. Find the line Key contentThe text to the right of the colon is your password. You can select it with your mouse and copy it (Ctrl+C) and paste it anywhere.
⚠️ Attention: When copying a password with the mouse in the command line, be careful. An accidental click can trigger the selection mode, causing the console to freeze until you press Enter. It's best to select the text carefully or use the right-click copy command if QuickEdit is enabled.
For convenience, you can copy the entire command above and paste it into the console (right-click or Ctrl+V), replace "Network_Name" with the actual name of your Wi-Fi and press Enter. This is the fastest way to access WPA2 key or WPA3.
☑️ Check before entering a command
Alternative method: output all passwords to a text file
If you need to recover passwords for multiple networks or are worried about making mistakes when manually entering the network name, there's a more convenient method. The command line allows you to redirect the output directly to a text file on your desktop. This eliminates the need to copy and paste text from the black console window.
Use the following command line which will create a file wifi_passwords.txt on your desktop:
netsh wlan show profiles name="Network_Name" key=clear > "%userprofile%\Desktop\wifi_passwords.txt"
However, to download all passwords for all networks at once, you can use a more complex but effective command. It will create a file containing all profiles and their keys:
netsh wlan show profiles name="Network_Name" key=clear
(Note: Scripts are often used to bulk output all networks at once in one line, but it is easier to output each important network separately to a file, changing the name, or use the command `netsh wlan export profile folder="C:\Wifi" key=clear`, which will create XML files for each network in the C:\Wifi folder).
Let's consider the XML export option, as it's the most reliable for preserving the data structure. The command will create a folder and place files there, containing the tag keyMaterial with your password in clear text.
netsh wlan export profile folder="C:\WifiBackup" key=clear
After running this command, go to the folder C:\WifiBackup (You need to create it in advance or specify an existing one). There will be files with network names. Open the required file with Notepad and find the line keyMaterialThe password will be inside the tag.
Table of basic Wi-Fi control commands in CMD
To help you organize your knowledge, we've provided a table of the basic commands you might need when diagnosing and configuring wireless connections via the console. These commands work on most versions of Windows, starting with Windows 7.
| Team | Description of action | Necessary rights |
|---|---|---|
netsh wlan show profiles |
Shows a list of all saved networks. | User |
netsh wlan show profile name="Name" key=clear |
Shows details and password of a specific network | Administrator |
netsh wlan delete profile name="Name" |
Deletes a network profile (forgets the network) | Administrator |
netsh wlan show interfaces |
Shows the current connection status and signal | User |
netsh wlan disconnect |
Disconnects the current Wi-Fi connection | User |
Using the delete profile command (delete profile) can be useful if the network has changed encryption settings and the computer can't connect, returning the error "Can't connect to this network." Deleting the old profile forces Windows to prompt for the password again.
Team show interfaces is useful for diagnosing signal quality. It will show the signal strength as a percentage, the current connection speed (for example, 300 Mbps or 866 Mbps) and the type of radio used (802.11n/ac/ax).
⚠️ Attention: Command line interfaces and available parameters may vary slightly depending on your Windows version (Home, Pro, Enterprise) and wireless adapter driver version. If the command doesn't work, check the spelling of the network name.
Possible errors and solutions
When working with the command line, users often encounter common errors. Understanding their causes allows for quick resolution. Below are the most common issues and how to resolve them.
- 🛑 Error: "WLAN AutoConfig service is not running": If you see a message that the service is not running, the netsh commands will not work. You need to open the services (command
services.msc), find "WLAN AutoConfig Service" and start it. - 🛑 Error: "Network not found in profile": This most often indicates a typo in the network name. The name is case-sensitive and space-sensitive. Use the copy command from the profile list to avoid typing errors.
- 🛑 The "Key Content" field is missing.If the command output doesn't contain a line containing the key, you launched the console without administrator privileges. Close the window and restart the command as an administrator.
- 🛑 Problems with encoding: If the network name contains Cyrillic characters and the console displays "krakozyabry" (scrawl), try changing the encoding with the command
chcp 65001(UTF-8) orchcp 866(CP866) before entering commands.
In some cases, antivirus software may block attempts by programs (including the system console) to read saved passwords, interpreting this as malware. If you are confident in the security of your actions, add an exception to your antivirus settings or temporarily disable protection.
Questions and Answers (FAQ)
Is it possible to find out my neighbors' Wi-Fi password using the command line?
No, that's not possible. The command line only allows you to view passwords that are already saved on your computerConnecting to someone else's network without a password requires encryption cracking tools, which is illegal and beyond the scope of this article.
Where are Wi-Fi passwords stored in Windows 10 and 11?
Passwords are stored in the system registry and protected configuration files in the folder C:\ProgramData\Microsoft\Wlansvc\Profiles\InterfacesHowever, they are encrypted and cannot be read directly without using a utility. netsh or special decoders are impossible.
What to do if the "netsh" command is not found?
Team netsh is built into Windows. If the system reports that the command is not found, it means that system files or environment variables are corrupted. Try specifying the full path: C:\Windows\System32\netsh.exe.
Does this method work on macOS or Linux?
No, the Windows command line syntax (CMD/PowerShell) does not work on other operating systems. On macOS, passwords are stored in Keychain Access, and on Linux, they are stored in text configuration files in the /etc/NetworkManager/ or through utilities like nmcli.
Is it safe to use command prompt to view passwords?
Yes, using the built-in utility netsh It's completely safe. You don't install third-party software or share your data with third parties. The only risk is leaving an open text file with passwords in a publicly accessible location on your computer.