Finding a saved Wi-Fi password on a Windows computer is a common task, whether you are setting up a new device, helping a guest connect, or simply forgot the complex string of characters you set months ago. While the graphical interface in Settings allows you to view the password for the currently connected network, the Command Prompt (CMD) offers a powerful, scriptable way to retrieve credentials for any network profile stored on the machine. This method works on Windows 10, Windows 11, and even older versions like Windows 7 and 8, provided you have administrative privileges Simple as that..
Why Use Command Prompt for Wi-Fi Passwords?
The Command Prompt approach is often preferred by power users and IT professionals for several reasons. Plus, first, it bypasses the multiple clicks required in the modern Settings app (Network & Internet > Advanced Network Settings > More Network Adapter Options > Status > Wireless Properties > Security > Show Characters). Second, it allows you to list all saved profiles instantly, including networks you are not currently connected to but have connected to in the past. That's why third, the output is clean text, making it easy to copy, paste into a document, or pipe into a script for documentation purposes. Understanding how to get wifi password from cmd transforms a tedious GUI hunt into a two-command operation.
Prerequisites: Administrator Access
Before diving into the commands, there is a non-negotiable requirement: You must run Command Prompt as an Administrator. Standard user privileges will allow you to list profiles, but the crucial command to reveal the Key Content (the actual password) requires elevated rights to access the protected Wireless LAN (WLAN) service data.
This changes depending on context. Keep that in mind.
To open an elevated Command Prompt:
- Do not press Enter. Practically speaking, press the Windows Key or click the Start button. Even so, instead, right-click the "Command Prompt" result. Still, type
cmdorCommand Prompt. Select Run as administrator. -
-
-
- Click Yes on the User Account Control (UAC) prompt.
-
-
You will know you are in the correct mode because the window title bar will read "Administrator: Command Prompt" and the prompt path will typically be C:\Windows\system32> That's the part that actually makes a difference..
Step 1: List All Saved Wi-Fi Profiles
The first step is identifying the exact name of the network profile (SSID) you want to inspect. Windows stores every network you have ever connected to (unless you explicitly chose "Forget") as a WLAN profile.
Type the following command and press Enter:
netsh wlan show profiles
Interpreting the Output
You will see a list categorized by interface (usually just "Wi-Fi" or "Wi-Fi 2"). Under each interface, you will see a list of User profiles Still holds up..
- Profile Name: This is the SSID (network name).
- Type: Usually "Wireless".
- Permissions: Usually "All users" or "Current user".
Example Output:
Profiles on interface Wi-Fi:
Group policy profiles (read only)
---------------------------------
User profiles
-------------
All User Profile : HomeNetwork_5G
All User Profile : CoffeeShop_FreeWiFi
All User Profile : Office_Guest
All User Profile : OldRouter_2.4GHz
Pro Tip: If the list is long, you can pipe the output to a text file for easier reading:
netsh wlan show profiles > "%USERPROFILE%\Desktop\wifi_list.txt"
This creates a file on your Desktop containing the list.
Step 2: Reveal the Password for a Specific Profile
Once you have identified the exact Profile Name (SSID) from the list above, you can query that specific profile for its security settings. That's why the key parameter here is key=clear. Without this flag, the Key Content field will be hidden or shown as asterisks Easy to understand, harder to ignore. No workaround needed..
Type the following command, replacing "Your_Network_Name" with the actual profile name. Keep the quotation marks if the name contains spaces No workaround needed..
netsh wlan show profile name="Your_Network_Name" key=clear
Example
If the network name is HomeNetwork_5G:
netsh wlan show profile name="HomeNetwork_5G" key=clear
If the network name is Coffee Shop WiFi (with spaces):
netsh wlan show profile name="Coffee Shop WiFi" key=clear
Step 3: Locate the "Key Content"
After executing the command, a detailed block of information will scroll by. You need to scroll up slightly or look near the bottom of the output under the Security settings section Easy to understand, harder to ignore. Simple as that..
Look for this specific block:
Security settings
-----------------
Authentication : WPA2-Personal
Cipher : CCMP
Authentication : WPA2-Personal
Cipher : GCMP
Security key : Present
Key Content : YourActualPassword123!
Cost : Unrestricted
Congested : No
The value next to Key Content is your Wi-Fi password Most people skip this — try not to..
What if "Key Content" is Missing or Blank?
- No "Security key : Present" line: If you see
Security key : Absent, the profile is likely for an Open (unsecured) network, or the password was not saved (e.g., "Connect automatically" was unchecked during initial connection). - Access Denied / "The Wireless AutoConfig Service (wlansvc) is not running": Ensure you are running CMD as Administrator. Also, check
services.mscto ensure "WLAN AutoConfig" is running. - Profile stores a Passphrase vs. Key: Modern Windows versions store the passphrase. Older enterprise setups might use 802.1X certificates (EAP-TLS/PEAP) where a user password isn't stored in the profile itself; instead, it prompts for credentials at connection time. In those cases,
Key Contentwill be empty.
Alternative One-Liner: Extract Only the Password
If you are scripting this or just want the password without the verbose output, you can use findstr to filter the result. This command outputs only the password line.
netsh wlan show profile name="Your_Network_Name" key=clear | findstr /C:"Key Content"
Output:
Key Content : YourActualPassword123!
This is significantly faster for copying the password directly.
PowerShell Alternative (Modern Approach)
While CMD is universal, PowerShell offers a more object-oriented approach, which is useful if you want to export data to CSV or JSON. Since Windows 10/11 includes PowerShell by default, this is a viable alternative Took long enough..
Open PowerShell as Administrator and run:
(netsh wlan show profiles) | Select-String "\:(.+)$" | ForEach-Object { $_.Matches.Groups[1].Value.Trim() } | ForEach-Object {
$profile = $_
$result = netsh wlan show profile name="$profile" key=clear
if ($result -match "Key Content\s+:\s(.+)") {
[PSCustomObject]@{
SSID = $profile
Password = $Matches[1].Trim()
}
}
} | Format-Table -AutoSize
This script loops through all profiles and outputs a clean table of SSIDs and Passwords. It automates the entire "list then query" process Still holds up..
Understanding Where This Data Lives
It helps to understand what you are querying. The `net