How to connect to Wi-Fi using the Windows 10 command line

When the operating system's graphical interface stops responding and the wireless network icon disappears from the system tray, it often takes users by surprise. In such cases, standard methods like scanning for available networks become unavailable, leaving the only option left. command lineUsing the console allows you not only to establish a connection but also to conduct in-depth driver diagnostics or reset frozen network services that are blocking the module's operation.

Working with the console Windows 10 Requires precise command entry, as the system doesn't offer syntax autocorrection like modern graphical shells. However, this method provides direct access to the network adapter API, bypassing potential GUI bugs. The netsh wlan commands allow you to manage wireless connections even when the standard interface is completely inoperative.

In this guide, we'll walk you through the process of scanning the airwaves, creating a security profile, and forcing a connection to an access point. You'll learn how to bypass driver errors and restore internet access without restarting your computer or using third-party software.

Launch Command Prompt with Administrator Privileges

To perform any operations related to changing network settings, you must run the console as the superuser. Normal user mode does not provide sufficient privileges to interact with adapter drivers. Wi-FiThere are several ways to open the tool you need, but the most reliable is to search through the Start menu.

Press the key combination Win + X and select "Windows PowerShell (Admin)" or "Command Prompt (Admin)" from the context menu that appears. If the menu doesn't appear, you can press Win + R, enter cmd and press Ctrl + Shift + Enter, which will force the terminal to launch with elevated privileges. Without these privileges, you'll get an access error when attempting to run the connection command.

Make sure the window title contains the word "Administrator." This is critical, as network management commands modify the system registry and driver configuration files. On some corporate networks, security policies may prevent the console from running, requiring you to contact your system administrator.

⚠️ Attention: If you see a permissions error message when launching the console, do not attempt to bypass system restrictions. Running in normal user mode will only result in command execution errors and will not change network settings.

📊 Which method of launching the console do you use most often?
Via Windows Search
Win+X combination
Through the Task Manager
Right click on the shortcut

Check adapter status and scan networks

The first step after starting the console should be checking the physical status of the wireless module. Often, the problem isn't a lack of network connectivity, but rather that the adapter itself is software-disabled or in an error state. For initial diagnostics, use the command netsh wlan show interfaces, which will display detailed information about the current state.

In the command output, pay attention to the "State" line. If it says "Disconnected," the adapter is ready to use but not connected. If the status is "Not connected" or the adapter is not displayed at all, you may need to reinstall the drivers. The parameters are also important. SSID and the type of security that may be required for manual configuration.

Next, you need to get a list of available access points within range. Command netsh wlan show networks will scan the airwaves. The system may ask for confirmation to enable the wireless network service if it was previously disabled. The list will display network names (SSIDs), signal strength, and encryption type.

  • 📡 SSID — the name of the wireless network that is displayed in the list of available connections.
  • 🔒 Security type — encryption protocol, usually WPA2-Personal or WPA3 for modern routers.
  • 📶 Signal — the received signal level in percent, critical for connection stability.

If scanning doesn't reveal your network, check to see if the SSID is hidden by the router. Hidden networks don't broadcast their name and require manual profile creation with the exact name and security type.

Creating and configuring a connection profile

To connect to a network, especially if it's hidden or requires specific settings, you need to create an XML profile. However, for standard situations, there's a faster method using the command addThe syntax requires the network name (SSID) and security key. The command looks like this:

netsh wlan add profile filename="profile.xml" interface="Wi-Fi"

An easier way to quickly connect without creating files is to use the connection command and specify a key. First, create a profile, then connect. To create a profile in the console, enter:

netsh wlan add profile name="MyNetwork" keyMaterial="MyPassword" ssid="MyNetwork"

In this team name - this is the name of the profile in the system, keyMaterial - your Wi-Fi password, and ssid — the exact network name. Please note that the SSID is case-sensitive. If the network name contains spaces, be sure to enclose it in quotation marks.

Once a profile is created, it's saved in the system and will be used for automatic connections in the future. You can create profiles for multiple networks, and Windows will prioritize them based on connection order or signal strength.

⚠️ Attention: When you enter your password in the command line, it is displayed in clear text. Make sure no one is nearby who can see your security key, or use the copy-from-clipboard method.

Connection process and connection check

After successfully creating the profile, you need to initiate the connection. To do this, use the command connectEnter . netsh wlan connect name="Profile_Name"The system will attempt to find a network with the specified name and log in using the saved credentials.

The process may take a few seconds. If the connection is successful, you'll see the message "Connected." If an error occurs, the system will display an error code, such as "Invalid security key" or "Network not found." If successful, the tray indicator will change, confirming an internet connection.

To check the connection quality, you can run the ping utility. Enter ping 8.8.8.8 -t to continuously check the availability of Google servers. This will help identify packet loss or high latency (ping), which is especially relevant for online gaming and video calling.

  • 🔗 Connect — a command to initiate a connection with the selected profile.
  • 📉 Ping — a utility for checking node availability and measuring latency.
  • 🔄 Disconnect — a command to break the current connection.

Sometimes you need to force a connection to be terminated before trying again. Use the command netsh wlan disconnectto reset the current session and clear the connection cache.

Managing saved Wi-Fi profiles

The operating system stores a history of all networks you've ever connected to. Over time, this list can grow, including obsolete profiles or networks with changed passwords. To view a list of all saved profiles, use the command netsh wlan show profiles.

In the output, you'll see a list of profile names. To see detailed information about a specific profile, including the encryption type and even the password (in plaintext), add the parameter key=clearThe command will look like this: netsh wlan show profile name="ProfileName" key=clearIn the Security settings section, the password will be displayed in the Key Content field.

Deleting unnecessary profiles helps avoid connection conflicts when the computer tries to connect to an old network with a similar name. To delete, use the command netsh wlan delete profile name="ProfileName"This action is irreversible, and you will need to re-enter your password to reconnect.

Team Description of action Necessary rights
show profiles Displays a list of all saved networks. User
delete profile Deletes a network profile from memory. Administrator
export profile Saves the profile to an XML file. Administrator
add profile Adds a new profile from a file Administrator

Exporting profiles to an XML file is useful for backing up settings before reinstalling the system. You can transfer the file to another computer and import it, automatically configuring network access.

Diagnosing and resetting network settings

If connecting via the command line fails and the drivers are installed correctly, the problem may lie in the TCP/IP protocol stack or DNS cache. The first step in troubleshooting is to reset the network settings. Enter netsh int ip reset And netsh winsock reset to restore standard protocol parameters.

After performing the reset, you will need to restart your computer. It is also useful to clear the DNS cache with the command ipconfig /flushdnsThis eliminates name resolution issues where websites won't open even though there's a connection to the router.

For deep diagnostics use the command netsh wlan show wlanreportIt will generate a detailed HTML report of all Wi-Fi-related events for the last three days. The path to the report will be specified in the console, usually C:\ProgramData\Microsoft\Windows\WlanReport\wlan-report-latest.html.

⚠️ Attention: Interfaces and command names may vary slightly depending on your Windows 10 build version and language locale. If a command fails, check the spelling in English, even if you have a Russian version of the OS.

☑️ Wi-Fi Diagnostic Checklist

Completed: 0 / 5

Frequently Asked Questions (FAQ)

How do I find the password for a saved Wi-Fi network using the command line?

Use the command netsh wlan show profile name="Network_Name" key=clearIn the "Security Settings" section, find the "Key Content" field, where the password will be displayed in clear text. Administrator privileges are required.

What to do if netsh command is not found?

Team netsh is a system program and is present in all versions of Windows. If it is not found, you probably did not run the command prompt as an administrator or the system files are corrupted. Try repairing the system files with the command sfc /scannow.

Is it possible to connect to a hidden network via CMD?

Yes, but this requires manually creating a profile with the exact SSID name and security type, even if the network doesn't broadcast its name. Use the command add profile specifying all the parameters, then make the connection.

How to delete all saved Wi-Fi profiles at once?

There's no automatic command to delete all profiles at once. However, you can write a simple script that will list all profiles and delete them one by one. Alternatively, you can delete them manually using the command delete profile for each name from the list.