Setup and Configuration

How to Know Password of Wifi Using Cmd? Run Netsh

Introduction If you have ever connected your Windows computer to a wireless network and later forgotten the password, you know how frustrating it can be. Maybe you want to connect a new phone, share the password with a friend, or troubleshoot your network. For

HowToFixWiFi

Introduction

If you have ever connected your Windows computer to a wireless network and later forgotten the password, you know how frustrating it can be. Maybe you want to connect a new phone, share the password with a friend, or troubleshoot your network. Fortunately, Windows stores every WiFi profile you have ever connected to, along with its password, and you can retrieve it using the Command Prompt with a simple built-in tool called netsh. In this guide, you will learn exactly how to know password of WiFi using cmd, step by step, without installing any third-party software.

The netsh wlan show profile command and its companion key=clear parameter are built into every modern Windows system. They allow you to list all saved wireless networks and display the security key in plain text. This method works on Windows 10 and Windows 11, as well as older versions like Windows 7 and Windows 8. By the end of this article, you will not only know how to reveal a single saved password but also how to export all of them, understand what the output means, and stay on the right side of security and privacy.

Table of Contents

What Is Netsh and Why Use It?

netsh stands for Network Shell. It is a command-line scripting utility that allows you to display or modify the network configuration of a computer. Among its many capabilities, the wireless LAN helper, accessed through netsh wlan, lets you interact with WiFi profiles stored on your machine.

When you connect to a wireless network and choose to remember it, Windows saves a profile. That profile includes the SSID, authentication type, encryption method, and the password, which Windows calls the “key material.” The netsh wlan show profile command can display all of this information. Adding key=clear tells Windows to reveal the password instead of hiding it.

The reason this works is that Windows stores these profiles locally in XML files. The password is encrypted by default, but Windows decrypts it on demand for authorized users. That is why you usually need to run Command Prompt as an administrator to see the key.

Prerequisites Before You Begin

Before you start, make sure the following conditions are met so the commands work correctly:

  • You are using a Windows computer (Windows 7, 8, 8.1, 10, or 11).
  • You have connected to the WiFi network at least once before and saved the profile.
  • You have administrator privileges on the computer.
  • The network adapter is not disabled (although profiles can still be listed even if the adapter is off).

If you have never connected to the network on this machine, there will be no stored profile, and the method will not return a password. In that case, you would need to check your router’s label or admin panel instead.

How to Open Command Prompt as Administrator

The first step is to open Command Prompt with elevated permissions. Here is how to do it on modern Windows versions:

  1. Click the Start button or press the Windows key.
  2. Type cmd or Command Prompt.
  3. Right-click on Command Prompt in the search results.
  4. Select Run as administrator.
  5. If prompted by User Account Control, click Yes.

Alternatively, you can press Windows + X and choose Terminal (Admin) or Command Prompt (Admin) from the menu. On Windows 11, Windows Terminal may open by default with PowerShell, but you can switch to Command Prompt from the dropdown or simply type cmd in the search bar.

Once the window opens, you should see a title bar that includes “Administrator” and a prompt that looks like C:\Windows\System32>. This confirms you have the necessary privileges.

List All Saved WiFi Profiles

Before retrieving a password, you need to know the exact name of the WiFi profile. Windows stores profiles by their SSID, which is the network name. To list every saved wireless profile, run the following command:

netsh wlan show profiles

After pressing Enter, you will see a list under the heading “Profiles on interface Wi-Fi” (or similar). Each entry looks like this:

User profiles
-------------
    All User Profile     : HomeNetwork
    All User Profile     : OfficeWiFi
    All User Profile     : Hotel_Guest

Make a note of the exact name, including spaces and capitalization. You will use this name in the next step. If the list is long, you can scroll up, or you can pipe the output to a text file for easier reading, which we will cover later.

Reveal the Password of a Specific WiFi Network

Now that you know the profile name, you can reveal its password. Use this command, replacing WiFiName with the actual network name:

netsh wlan show profile name="WiFiName" key=clear

For example, if your network is called HomeNetwork, you would type:

netsh wlan show profile name="HomeNetwork" key=clear

Press Enter. Windows will print a detailed profile report. Scroll down to the Security settings section. You will see a line that reads:

Key Content            : yourpasswordhere

The value after the colon is your WiFi password in plain text. That is the answer to how to know password of WiFi using cmd. You can copy it directly from the console window by right-clicking and selecting Mark, then highlighting the text and pressing Enter to copy.

If your network name contains spaces, always wrap it in double quotes. If it contains special characters, the quotes are even more important. Without them, the command may fail or interpret only part of the name.

How to Read the Command Output

The output of netsh wlan show profile name="WiFiName" key=clear contains more than just the password. Understanding the full output helps you troubleshoot connection issues as well. Here are the key sections:

  • Profile information: Shows the profile name, GUID, and whether it is a group policy or user profile.
  • Connectivity settings: Indicates whether the network connects automatically and whether it is hidden.
  • Security settings: Displays the authentication type (such as WPA2-Personal), cipher (such as CCMP), and the key content, which is the password.
  • Cost settings: Shows whether the connection is metered.

If the Key Content line says Present instead of an actual password, you did not run Command Prompt as an administrator. Reopen it with elevated privileges and try again.

Retrieve Passwords for All Saved Networks at Once

If you want to recover passwords for multiple networks without running the command one by one, you can use a loop in Command Prompt. This single line iterates through every profile and displays the key content:

for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @echo %j & netsh wlan show profile name="%j" key=clear | findstr "Key Content"

This command parses the list of profiles and runs the show profile command for each, filtering the output to show only the Key Content line. It is a quick way to audit all saved networks. Be aware that the formatting may look slightly messy because of leading spaces, but the password will be visible.

Alternatively, you can use a more readable approach by writing a small batch file, which we will discuss next.

Export WiFi Profiles and Passwords to a File

Sometimes you want to back up all your WiFi profiles and passwords, perhaps before reinstalling Windows or migrating to a new computer. Netsh supports exporting profiles to XML files, including the password in plain text if you add the right parameter.

Run this command to export all profiles to a folder:

netsh wlan export profile folder=C:\WiFiBackup key=clear

This creates one XML file per saved network in the C:\WiFiBackup folder. Each XML file contains the SSID, security settings, and the password inside a <keyMaterial> tag. You can open these files with Notepad to read the passwords.

To import a profile later on another machine, use:

netsh wlan add profile filename="C:\WiFiBackup\WiFi-HomeNetwork.xml"

This is especially useful for IT administrators managing multiple machines or users setting up a new laptop.

Using a Simple Batch Script to Automate the Process

If you frequently need to look up WiFi passwords, you can create a reusable batch script. Open Notepad, paste the following code, and save the file as ShowWiFiPasswords.bat:

@echo off
setlocal enabledelayedexpansion
for /f "skip=9 tokens=1,2 delims=:" %%a in ('netsh wlan show profiles') do (
    set "ssid=%%b"
    set "ssid=!ssid:~1!"
    if not "!ssid!"=="" (
        echo Network: !ssid!
        netsh wlan show profile name="!ssid!" key=clear | findstr "Key Content"
        echo.
    )
)
pause

Double-click the batch file, and it will run in a Command Prompt window, listing every saved network alongside its password. You can keep this script on a USB drive for troubleshooting purposes. Always store it securely, because anyone who runs it can see all your saved passwords.

PowerShell Alternative for the Same Task

Although this guide focuses on how to know password of WiFi using cmd, it is worth noting that PowerShell offers an alternative. You can retrieve the password with a one-liner that uses the same underlying netsh command but formats the output more cleanly:

(netsh wlan show profile name="HomeNetwork" key=clear) -match "Key Content" -replace ".*:\s*"

PowerShell also allows you to convert the output into objects for easier scripting. However, for most users, the standard Command Prompt method is simpler and requires no scripting knowledge. The netsh approach remains the most universal because it works on every Windows version without enabling additional features.

Troubleshooting Common Errors

Even though the process is straightforward, you may encounter issues. Here are the most common problems and how to fix them:

  • “The wireless AutoConfig service (wlansvc) is not running.” Start the service by running net start wlansvc in an elevated Command Prompt.
  • “There is no wireless interface on the system.” Your computer may not have a WiFi adapter, or the driver may be disabled. Check Device Manager.
  • “Profile not found.” The name may have a typo or extra spaces. Run netsh wlan show profiles again and copy the exact name.
  • Key Content shows “Present” instead of the password. You are not running as administrator. Reopen Command Prompt with elevated rights.
  • Access denied. Your user account lacks administrator privileges. Log in with an admin account or ask your IT department.
  • Empty password field. Some enterprise networks use 802.1X authentication, where the password is not stored locally. In that case, the key content will be blank.

If none of these solutions work, you can also check the router’s admin panel or the sticker on the router itself for the default password.

Comparison of Methods to Find WiFi Passwords

There are several ways to recover a WiFi password on Windows. The table below compares the most common approaches so you can choose the one that fits your situation.

Method Requires Admin Rights Works Offline Shows All Networks Ease of Use
Netsh Command Prompt Yes Yes Yes (with loop) Easy
Windows Settings (Network & Internet) No Yes No (current only) Very Easy
Control Panel Network Sharing Center No Yes No (current only) Easy
Router Admin Panel No (router login) No Yes Moderate
Third-Party Software Varies Yes Yes Easy

As you can see, the netsh method is the most powerful built-in option because it works offline, reveals passwords for every saved network, and does not require installing anything. The Windows Settings method is easier for beginners but only shows the password for the currently connected network.

Security and Privacy Considerations

Because this method exposes passwords in plain text, it carries real security implications. Anyone with administrator access to your computer can run these commands and see every WiFi password you have ever saved. This is by design, since Windows assumes that an administrator is a trusted user.

Here are some important points to keep in mind:

  • Never run these commands on a computer you do not own or have permission to access.
  • Do not share screenshots of the output, as they may contain real passwords.
  • Delete exported XML files after you have finished using them.
  • Use strong, unique passwords for your WiFi networks to limit damage if one is exposed.
  • Consider disabling the “Remember this network” option on public or temporary networks.
  • Enable WPA3 or WPA2 with AES encryption on your router to protect against wireless attacks.

If you are an IT professional, you can use Group Policy to restrict access to netsh or disable the storage of wireless profiles altogether on sensitive machines.

Tips and Best Practices

To get the most out of this technique and keep your network secure, follow these tips:

  • Always double-check the profile name before running the command. A single typo will produce a “Profile not found” error.
  • Use quotes around network names that contain spaces or special characters.
  • Redirect output to a file if you need to review it later: netsh wlan show profile name="HomeNetwork" key=clear > C:\wifi.txt.
  • Keep your Windows system updated so that netsh behaves consistently across versions.
  • Periodically audit your saved profiles with netsh wlan show profiles and delete ones you no longer need using netsh wlan delete profile name="OldNetwork".
  • Store recovered passwords in a password manager rather than in plain text files.
  • If you are helping a friend or family member, walk them through the steps instead of doing it silently, so they learn and consent to the process.

Frequently Asked Questions

Can I use this method on Windows 11?

Yes. The netsh commands work identically on Windows 11. The only difference is that Windows Terminal may open PowerShell by default, so you may need to switch to the Command Prompt tab or type cmd to launch it.

Does this work if I am not connected to the network right now?

Yes. As long as the profile is saved on your computer, you can retrieve the password even if you are currently offline or connected to a different network.

Why does Key Content say “Present”?

This happens when Command Prompt is not running as an administrator. Close the window and reopen it with elevated privileges, then run the command again.

Can I recover a password for a network I never connected to?

No. Netsh only shows profiles that have been saved on your machine. For networks you have never joined, you will need to ask the network owner or check the router.

Is it legal to use this method?

It is legal to recover passwords for networks you own or have permission to access. Using it to access someone else’s network without authorization may violate computer fraud and privacy laws.

What if my network uses WPA3?

The command works the same way. The output will show WPA3 under the authentication type, and the key content will still display the password.

Can I do this without administrator rights?

No. Windows requires administrator privileges to reveal the key material. Standard users will only see “Present” instead of the actual password.

How do I delete a saved WiFi profile?

Run netsh wlan delete profile name="WiFiName" in an elevated Command Prompt. This removes the profile and its stored password from your computer.

Conclusion

Learning how to know password of WiFi using cmd is a valuable skill for any Windows user. With just a few simple netsh commands, you can list every saved wireless profile, reveal its password in plain text, and even export all of them for backup or migration. The process is fast, requires no third-party tools, and works across all modern Windows versions. Remember to run Command Prompt as an administrator, quote network names with spaces, and handle the revealed passwords responsibly. By following the steps, tips, and troubleshooting advice in this guide, you can confidently recover any saved WiFi password whenever you need it while keeping your digital life secure.