Managing wireless connections through the Windows graphical interface is familiar, but not always effective. Sometimes the system freezes, drivers don't work correctly, or you need to automate the network connection process in a corporate environment. In such cases, command line becomes an indispensable tool for the administrator and advanced user, allowing direct interaction with WLAN API.
Using the console gives you access to hidden settings that can't be changed through the standard "Settings" menu. You can force a connection, clear the list of saved profiles, or adjust network priority. This is especially useful when diagnostics connection problems when conventional methods prove ineffective.
In this article, we'll cover the basic Wi-Fi commands, examine the syntax for creating profiles, and learn how to manage adapter status. Once you master these skills, you'll gain complete control over your computer's network connections.
Launch Command Prompt with Administrator Privileges
Executing network commands requires elevated access rights. Launching the console normally won't allow you to make changes to system settings or save new profiles. The fastest way is to press the key combination Win + X and select "Windows PowerShell (Administrator)" or "Command Prompt (Administrator)".
An alternative option is to search for the application in the Start menu. cmd.exe, right-click, and select "Run as administrator." Without this step, many commands will return an access error.
⚠️ Warning: Running commands with administrator privileges makes changes to the registry and system files. Be careful when entering syntax, especially when deleting profiles.
Once the window opens, you'll see a standard black or blue background with a blinking cursor. The system is now ready to receive instructions to manage the network stack.
View available wireless networks
The first thing you need to do before connecting is to make sure the adapter can see nearby access points. This is done using a utility. netsh, which is a powerful network shell interface for Windows.
netsh wlan show networks
This command will list all visible networks with their SSIDs (names), security types, and signal strengths. If the list is empty, check whether the WiFi adapter is enabled physically or programmatically. The output will show the status of each network: connected, not connected, or hidden.
It's important to pay attention to the "Signal" column. The higher the percentage, the more stable the connection will be. Sometimes it makes sense to connect to a less congested channel of a neighboring router if the signal from the primary access point is too weak.
Connecting to an open and secure network
The connection process depends on the encryption type. For open networks (without a password), simply entering the profile name is sufficient. However, authentication is most often required. For WPA2/WPA3 secured networks, you must first create an XML profile file or use interactive key entry.
The easiest way to connect to a known network whose profile is already saved in the system:
netsh wlan connect name="Profile_Name"
Here Profile_Name must exactly match the name displayed in the list of saved profiles. If you are connecting for the first time and the network is password-protected, the system may prompt you for a security key via a graphical pop-up window, even if the command is run in the console.
For automatic connection without GUI intervention, you can create a profile manually. This requires creating an XML file with network parameters and a Base64-encoded key. This is a more complex procedure, but gives you complete control.
☑️ Check before connection
Make sure your password is case-sensitive. A single character error will result in access being denied, and the system will attempt to reconnect indefinitely until you cancel.
Managing saved WiFi profiles
Windows stores the settings of every network you've ever connected to. Over time, this list grows, which can cause priority conflicts. The command line makes it easy to manage this archive.
To view all saved profiles, use the command:
netsh wlan show profiles
You'll see a list of names. To view details of a specific profile, including encryption type and security settings, add a key. name:
netsh wlan show profile name="HomeWiFi" key=clear
Parameter key=clear is critically important - it displays the saved network password in clear text. This is the only way find out a forgotten password from WiFi, if you have access to a computer that is already connected to that network.
| Team | Description of action | Necessary rights |
|---|---|---|
show profiles |
List of all saved networks | User |
delete profile |
Deleting a network profile | Administrator |
export profile |
Saving a profile to XML | Administrator |
add profile |
Importing a profile from XML | Administrator |
Deleting unnecessary profiles frees up resources and prevents connection attempts to networks that are no longer relevant. It also improves security by preventing automatic connections to malicious access points with the same names (Evil Twin).
Reset and reinstall network settings
If your connection is unstable or DNS errors are occurring, a full reset of the network stack often helps. The command line allows you to do this faster and more thoroughly than standard troubleshooting tools.
Run the following commands in sequence to clear the cache and reset the settings:
ipconfig /releaseipconfig /renew
ipconfig /flushdns
netsh winsock reset
netsh int ip reset
After executing the command netsh winsock reset A computer restart is required. This resets the Winsock catalog to its default state, which often resolves issues with antivirus software blocking traffic or corrupted drivers.
⚠️ Note: After resetting Winsock, some VPN clients or specific network software may stop working. They will need to be reinstalled or reconfigured.
This method is "heavy artillery" and should be used when simpler methods like reconnecting fail. It resolves software conflicts at the operating system level.
Diagnostics and analysis of adapter status
For a deep analysis of the causes of WiFi problems, use the command netsh wlan show interfacesIt provides detailed technical information about the current status of the wireless adapter.
In the output you will find:
- 📡 State: current status (connected, disconnected, connecting).
- 📶 Signal: percentage of signal level (connection quality).
- 📡 Radio type: WiFi standard (802.11ac, 802.11ax, etc.).
- 🔒 Authentication: encryption method.
- 📉 Receive (Mbps) / Transmit (Mbps): current link speed.
If the Receive/Transmit speed is significantly lower than your router's rated speed, you may be located far from the signal source or there is significant interference. You can also see the adapter's MAC address here, which is useful for setting up filtering on the router.
By analyzing this data, you can understand whether the problem is hardware (weak signal) or software (driver errors, incorrect security settings).
Frequently Asked Questions (FAQ)
How to find out a WiFi password using the command line?
Use the command netsh wlan show profile name="NetworkName" key=clearIn the "Security settings" section, find the "Key Content" field—it will contain the password in clear text. This only works for networks the computer has connected to before.
Why doesn't the netsh wlan connect command work?
Most often, the issue is with access rights. Make sure the console is running as administrator. Also, check the spelling of the profile name (case-sensitive) and that the profile exists on the system.
Is it possible to connect to a hidden network (Hidden SSID) via console?
Yes, but to do this you must first create an XML profile manually, specifying the network name and parameter hidden, and then import it with the command netsh wlan add profileA simple scan won't detect such a network.
How do I prevent automatic connections to a specific network?
In the profile properties (via the GUI) or when creating the XML file, set the auto-connection parameter to false. You can delete the profile via the command line to prevent the system from remembering the network.
Do these commands work in Windows 11?
Yes, the netsh utility is a system utility and works the same on Windows 7, 8, 10, and 11. The PowerShell interface also fully supports these commands.