How to Share Wi-Fi from a Laptop Using the Command Line: A Complete Guide

When wired internet is only available on one device and a wireless connection is needed for a smartphone or tablet, a built-in Windows feature comes to the rescue. Creating a virtual hotspot allows you to turn your laptop into a fully-fledged router using your existing network connection. This solution is ideal for temporary use, business trips, or if your primary router breaks down.

Modern Microsoft operating systems such as Windows 10 And Windows 11, have powerful tools for working with networks. Using the command line gives the user greater control over the parameters of the network being created compared to the standard graphical interface. You can specify precise encryption parameters, the network name, and the adapter operating mode.

To successfully implement your plans, you won't need to install any third-party software. All the necessary utilities are already built into the system and are available immediately after installing the OS. The main requirement is a working Wi-Fi adapter, which supports access point mode. In this article, we'll walk you through the setup process in detail, from checking the hardware to troubleshooting common errors.

Checking if the hosted network adapter supports it

Before entering complex commands, you need to ensure that your network adapter is technically capable of operating in virtual router mode. Not all wireless modules support this feature, especially on older laptop models or when using outdated drivers. This can be verified using the netsh system utility.

Open a command prompt with administrator privileges. To do this, right-click the Start menu and select the appropriate option from the list. In the window that appears, enter the command netsh wlan show drivers and press Enter. The system will display a detailed report on the characteristics of your wireless adapter.

Carefully review the list of parameters. Look for the line labeled "Hosted network supported." If the value is "Yes," your adapter is ready to use. If the value is "No," you'll need to update the device drivers or replace the network module.

Often, the problem lies in the software. Manufacturers periodically release updates that add support for new standards and features. Make sure you're using the latest driver version for your model. Wi-Fi adapter.

Configuring virtual access point settings

Once you've confirmed hardware compatibility, you can begin configuring your network settings. You'll need to set a network name (SSID) and password to connect. This information will be used by other devices to find and authenticate to your new network.

At the command prompt, enter the following, replacing "MyNetwork" with the desired name and "MyPassword123" with a complex password:

netsh wlan set hostednetwork mode=allow ssid=MyNetwork key=MyPassword123

Please pay attention to password requirements. It must be at least 8 characters long. Using simple combinations reduces the security of your data. We recommend using mixed-case letters, numbers, and special characters to create a strong encryption key. WPA2-Personal.

If you want to change the name or password in the future, simply re-enter the command with the new values. The system will update the virtual adapter configuration. Once the command completes successfully, you will see a message indicating that the hosted network settings have been successfully changed.

☑️ Pre-launch check

Completed: 0 / 4

It's important to note that this command creates the configuration but doesn't activate it immediately. To start the network, you'll need to perform another step, which we'll discuss in the next section. For now, your network is "registered" in the system, but in a disabled state.

Starting Wi-Fi distribution and network management

To activate the created access point, use the launch command. Enter netsh wlan start hostednetwork in the command line. If everything went well, you'll see the message "The hosted network has started." At this point, the laptop will begin broadcasting a signal.

Network status is controlled by three main commands. You can not only start but also stop seeding, as well as view the current status. This is convenient for saving battery life or temporarily blocking access.

  • 🟢 Launch: netsh wlan start hostednetwork - activates signal transmission.
  • 🔴 Stop: netsh wlan stop hostednetwork — stops distribution, but saves the settings.
  • 📊 Status: netsh wlan show hostednetwork — shows detailed information about connected clients and network status.

In the status window, you can see the number of connected devices, their MAC addresses, and authentication type. This is a useful monitoring tool: you'll always know who's using your traffic. If you spot an unfamiliar user, simply change the password using the settings command.

Please note that the created network does not start automatically when you reboot your computer. You will need to manually enter the startup command each time or create a special script. This is done for security purposes to prevent devices from becoming open access points without the owner's knowledge.

Setting up Internet access sharing (NAT)

Launching a virtual network is only half the battle. Devices can connect to your laptop now, but they won't have access to the global network. You need to forward the internet connection from the primary adapter (the one your laptop uses to connect to the network) to the virtual adapter you created.

To do this, go to the Network Control Panel. Click Win + R, enter ncpa.cpl and press Enter. Find your primary internet connection (Ethernet or Wi-Fi). Right-click it, select "Properties," then the "Sharing" tab.

Check the box next to "Allow other network users to connect through this computer's Internet connection." In the drop-down list below, select the virtual adapter, typically named "Local Area Connection" with a number or "Wireless Network Connection" with a version number.

Parameter Description Where to find
Adapter name Virtual Adapter or Microsoft Hosted Network ncpa.cpl
IP protocol TCP/IPv4 (must be active) Adapter properties
Gateway IP address Usually 192.168.137.1 Network status
Access status General access allowed Access tab

After applying the settings, the system may warn you about a change in the IP address. This is normal, as the computer assigns itself a static address for the internal network. Click "Yes" to confirm. Clients should now be able to access the internet when connected to Wi-Fi.

What to do if the Internet doesn't appear?

Make sure the TCP/IPv4 protocol is configured to obtain an IP address automatically in the virtual adapter properties. Sometimes, temporarily disabling your antivirus or firewall software for a test can help.

Automating the process via a bat file

Constantly entering commands manually can be tedious, especially if you use this feature regularly. Windows allows you to automate the process using batch files (.bat). These are simple text files containing a sequence of commands that the system executes.

Create a new text document on your desktop. Open it and enter the following lines:

netsh wlan set hostednetwork mode=allow ssid=MyNetwork key=MyPassword123

netsh wlan start hostednetwork

Save the file by selecting the "All files" save type and giving it the .bat extension, for example start_wifi.batNow, to launch the access point, simply run this file. However, for the commands to execute correctly, the file must be run as administrator.

  • 📁 Create a text file on your desktop.
  • ✍️ Enter the required netsh commands.
  • 💾 Save the file with the .bat extension.
  • ⚙️ Set the file to run as administrator in the file properties.

For even more automation, you can set up a task in Windows Task Scheduler. This will allow Wi-Fi sharing to start automatically when the computer is turned on or the user logs in, without the need for manual intervention.

📊 How do you prefer to manage your network?
Through the command line every time
Using a bat file
Via Windows settings (Mobile hotspot)
I use third-party programs

Solutions to common errors and problems

During the setup process, users often encounter various errors. The most common one is "Failed to start the hosted network." This may be caused by the WLAN AutoConfig service, which should be active. Check its status in the "Services" section (services.msc).

⚠️ Attention: Operating system interfaces are subject to update. The location of the "Control Panel" or "Settings" menu items may vary slightly depending on the Windows 10 or 11 build version. If you can't find the item you need, use the system search.

Another common issue is that devices connect, but the internet doesn't work ("No internet access"). In 90% of cases, this can be resolved by rechecking the "Sharing" tab in the primary adapter's properties. Sometimes, toggling the sharing checkbox helps: uncheck it, click OK, then recheck it and select the desired virtual adapter.

If your laptop "sees" the network but won't connect, try forgetting the network on the client device and reconnecting. It's also worth checking whether your antivirus software is blocking new network connections. Temporarily disable your firewall for diagnostics.

In some cases, the Wi-Fi adapter driver may not work correctly with virtual access point mode. Try unchecking the "Allow the computer to turn off this device to save power" option in the adapter's properties on the "Power" tab in Device Manager.

Frequently Asked Questions (FAQ)

Is it possible to share Wi-Fi if the laptop is connected to the Internet via Wi-Fi?

Technically, this is possible, but requires two Wi-Fi adapters or support for "simultaneous operation." Most often, a laptop distributes internet via a cable (Ethernet) or a USB modem. Using a single adapter (receiving and distributing via Wi-Fi) may result in lower speed and stability.

How many devices can connect to such a network at the same time?

Windows' default connection limits allow for up to 100 devices. However, the actual number depends on the power of your Wi-Fi module and processor. For stable operation, it's recommended to not exceed 5-7 active clients.

Will the distribution work if the laptop goes into sleep mode?

No, when entering sleep mode, the network adapter is disabled to save power, and sharing will stop. To avoid this, set the power plan to "High Performance" and disable the hard drive and adapter shutdown.

How to completely delete a created virtual network?

To delete the network configuration, run the command netsh wlan set hostednetwork mode=disallowThis will delete the virtual adapter and reset its settings. You can then recreate it with different settings.