How to Connect to Wi-Fi Using the Command Prompt in Windows 10: A Complete Guide

Modern users are accustomed to relying on a graphical interface, but there are situations when the system crashes, drivers conflict, or remote control is required. In such cases, the standard Start menu may be unavailable, and an internet connection is critical. This is where Windows command line, a powerful tool that allows you to manage network adapters at a low level, bypassing graphical shells.

Knowing how to use console commands gives administrators and advanced users a distinct advantage in terms of speed and precision. You can not only connect to the network, but also conduct in-depth configuration. diagnostics connections, check the signal strength, or even create a profile for automatic connection in the future. This is especially relevant for server environments or when working with Windows 10 in non-graphical interface mode.

In this article, we will take a detailed look at the process of setting up a wireless connection using the utility. netshYou'll learn how to scan the air, create XML security profiles, and force connections, making it a powerful tool in your system administrator's arsenal.

Prepare the command prompt and run it as administrator

The first and most important step is obtaining the necessary access rights. Windows 10 is built on the principle of least privilege, so a standard console launch will not allow you to make changes to network settings. You need to launch the terminal with the required privileges. administrator, otherwise the commands will return an access error.

To do this, press the key combination Win + X and select "Windows PowerShell (Admin)" or "Command Prompt (Admin)". Alternatively, you can type cmd In the search box, right-click the result and select the appropriate option. Make sure the window title says "Administrator: Command Prompt."

⚠️ Note: If you are working on a corporate network, your account may not have local administrator rights. In this case, please contact your IT department, as attempts to bypass restrictions may be considered a violation of security policy.

After a successful launch, you'll see a black window with a blinking cursor. Your system is now ready to accept commands to manage the network stack. TCP/IP and wireless interfaces.

Diagnosing and checking the status of the wireless adapter

Before attempting to connect to the network, ensure that the wireless module is active and functioning properly. Often, connection issues are not caused by the router itself, but by the adapter itself being disabled by software or in an error state. First, check the list of all network interfaces.

Enter the command netsh wlan show interfacesThis command will display detailed information about the status of your Wi-Fi adapter. Pay attention to the "State" and "SSID" fields. If the status is "Disconnected," the adapter is ready to use. If you see "Not Connected" or the adapter is missing from the list, the driver may not be installed or the device may be disabled in Device Manager.

It's also helpful to check if Wi-Fi is enabled. Some laptops have physical switches or function keys (e.g. F2 or F12 (with an antenna icon) that can block the module's operation at the hardware level. The command line will show the "Hardware radio" (Radio type) status, which should be "Enabled."

Once you've verified that the adapter is working, you can move on to searching for available access points within range of your receiver.

Scanning for available wireless networks

The next step is to search for available networks. The operating system constantly scans the airwaves, but we need to get an up-to-date list indicating signal strength and encryption type. To do this, use the command netsh wlan show networks.

After entering the command, you'll receive a list of all detected networks. Each network will have its own index (SSID 1, SSID 2, etc.), name (SSID), and signal strength in percent. It's also crucial to pay attention to the "Authentication" field. This determines the credentials you'll need to connect.

  • 📡 WPA2-Personal — the most common security standard for home networks, requiring only a password.
  • 🔐 WPA3-Personal — a modern standard of enhanced security supported by new routers.
  • 🏢 WPA2-Enterprise — a corporate standard that often requires a login, password, and certificate.
  • 🔓 Open — a network without a password, connection to which is highly not recommended for security reasons.

Remember the exact network name (SSID), as you'll need it to create the profile. If the name contains spaces or special characters, you'll need to enclose it in quotation marks when entering commands.

📊 What type of security does your home network use?
WPA2-Personal
WPA3-Personal
WPA-Enterprise
Open Network

Creating an XML profile for connection

Unlike the graphical interface, where you simply enter the password into a pop-up window, the command line requires you to first create a configuration file. This file contains all network parameters: the name, encryption type, and the password itself (in encrypted form). This may seem complicated, but this approach provides flexibility and the ability to deploy settings on a large scale.

To create a profile, we'll need an XML file. You can create it manually in Notepad or generate a template. Below is an example of the file structure, which should be saved with the .xml extension. .xml (For example, wifi_profile.xml) in a convenient folder, for example, on the root of the C: drive.

<?xml version="1.0"?>

<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">

<name>MyHomeWiFi</name>

<SSIDConfig>

<SSID>

<name>MyHomeWiFi</name>

</SSID>

</SSIDConfig>

<connectionType>ESS</connectionType>

<connectionMode>manual</connectionMode>

<MSM>

<security>

<authEncryption>

<authentication>WPA2PSK</authentication>

<encryption>AES</encryption>

<useOneX>false</useOneX>

</authEncryption>

<sharedKey>

<keyType>passPhrase</keyType>

<protected>false</protected>

<keyMaterial>VashParol123</keyMaterial>

</sharedKey>

</security>

</MSM>

</WLANProfile>

In this example the tag <name> And <ssid> must match the name of your network. In the field <keyMaterial> Enter your Wi-Fi password. Pay attention to the parameter <authentication>: for WPA2 Personal the value is used WPA2PSK, and for WPA3 - WPA3SAE.

⚠️ Warning: The created XML file stores the password in cleartext. Anyone with access to this file will be able to read your password. Be sure to delete the file after a successful connection or use strong disk encryption.

After creating the file, we proceed to import it into the system.

Importing a profile and connecting to the network

Now that the configuration file is ready, it needs to be added to the Windows profile store. To do this, use the command netsh wlan add profileIf you saved the file to the root of drive C, the command would look like this:

netsh wlan add profile filename="C:\wifi_profile.xml"

If the operation is successful, the system will report, "Profile successfully added." The profile is now available for use, but automatic connection may not occur immediately. To initiate a connection manually, use the connect command, specifying the network name and interface name.

The interface name can be found out from the command we ran at the beginning (show interfaces). Typically, this is "Wireless Network" or "Wi-Fi." The connection command looks like this:

netsh wlan connect name="MyHomeWiFi" interface="Wi-Fi"

Replacing MyHomeWiFi to the name of your network, and Wi-Fi By typing your adapter's name, you'll force the association process with the access point. If the password in the profile is correct and the signal strength is sufficient, you'll receive a successful connection message within a few seconds.

☑️ Connection algorithm

Completed: 0 / 4

This method is especially convenient because after importing the profile, the system will “know” this network and can connect to it automatically in the future if you set the appropriate priority.

Managing profiles and troubleshooting

Once connected, you can manage saved networks. For example, if you no longer use a network, it's best to delete its profile to avoid cluttering the list and creating priority conflicts. To view all saved profiles, use the command netsh wlan show profiles.

To delete an unnecessary profile, enter: netsh wlan delete profile name="Network_Name"This action is irreversible through the console without recreating the file, so be careful. You can also change the network priority so that the computer prefers one access point over another if they are both within range at the same time.

If the connection does not occur, use the command netsh wlan show networks mode=bssid for detailed signal analysis. It will show the MAC addresses of access points (BSSIDs) and the channels they operate on. This will help identify issues with airwave congestion or interference.

Hidden Networks (Hidden SSID)

If a network is hidden, it won't show up in a regular scan. To connect to a hidden network, you need to add a tag to the XML profile.<hidden> true</hidden> inside the block<SSIDConfig> .&

To reset all network settings to factory defaults (radical method), you can use the command netsh wlan delete profile name=* interface="Wi-Fi", which will delete all saved profiles for the specified interface.

Table of basic netsh wlan commands

For your convenience, below is a table of the basic commands you might need when administering wireless networks in Windows 10. Save this cheat sheet to avoid searching for the syntax every time.

Team Description of action Example of use
show interfaces Displays the status and properties of the Wi-Fi adapter. netsh wlan show interfaces
show networks Scans and displays available networks netsh wlan show networks
add profile Imports a profile from an XML file. netsh wlan add profile filename="C:\prof.xml"
connect Establishes a connection to the specified network netsh wlan connect name="Home"
delete profile Deletes a saved network profile. netsh wlan delete profile name="Home"

Using these commands turns a complex setup process into a predictable sequence of actions, independent of graphical interface bugs.

Frequently Asked Questions (FAQ)

Is it possible to connect to Wi-Fi without creating an XML file?

By standard command means netsh You can't enter a password directly into the line; a profile is required. However, if the network is open (without a password), you don't need to create a profile—the command is sufficient. connectFor secure networks, file creation is a mandatory Windows security requirement.

What should I do if the command says "Access Denied"?

This means you didn't run the command prompt as administrator. Close the terminal window, find cmd or PowerShell in the search, right-click and select "Run as administrator".

How do I find my Wi-Fi password using the command line?

If the computer is already connected to the network or was connected previously, use the command: netsh wlan show profile name="Network_Name" key=clearIn the "Security Settings" section, the "Key Contents" field will display the password in clear text.

Does this method work on Windows 11?

Yes, it is a utility. netsh and the command syntax is completely identical in Windows 10 and Windows 11. The command line interface remains the same, so the instructions apply to both operating systems.

Why doesn't Wi-Fi work after updating drivers?

After updating drivers, network settings may be reset. Try re-importing the profile or resetting the TCP/IP stack with the command netsh int ip reset in the command prompt with administrator rights, then restart the computer.