How to Share WiFi Using the Command Line: A Complete Guide

When your desktop router suddenly breaks down, or you need to quickly share your network with colleagues on a business trip, the built-in features of the Windows operating system come to the rescue. Creating a virtual access point (Virtual Hosted Network) lets you turn your laptop or PC with a Wi-Fi adapter into a fully-fledged router. This solution doesn't require third-party software and operates at the system kernel level, ensuring a stable connection.

Many users are afraid of the command line, considering it the domain of advanced system administrators, but the process of starting a network is surprisingly simple and consists of only a few steps. Command line interface Provides direct access to network drivers, allowing you to manage internet sharing settings much more flexibly than standard settings menus. In this article, we'll cover each step in detail, from checking for feature support to troubleshooting common errors.

The main tool for us will be the utility netsh, which is a standard component of Windows, starting from version 7 and ending with the latest builds of Windows 10 and 11. Using this tool, you can set a network name (SSID), set a password, and start distributing in literally one minute. It is critical that your computer's network adapter supports Hosted Network mode and has up-to-date drivers.

Checking virtual network mode support

Before you try to start the access point, you need to make sure that your Wi-Fi adapter It's physically and software-wise capable of operating in emulation mode. Not all wireless cards support simultaneous operation in client mode (receiving internet) and access point mode (distributing). To test this capability, we'll use a diagnostic command.

Run the command prompt as administrator. This is a requirement, as changing network settings requires elevated privileges. Enter the command netsh wlan show drivers and carefully examine the output. You're interested in the line "Hosted network supported."

If this line says "Yes," you can safely proceed with setup. If you see "No," the problem lies with the drivers or limitations of the hardware itself. In some cases, reinstalling the drivers from the adapter manufacturer's official website helps; newer versions with enhanced functionality may be available there.

What to do if there is no support?

If the driver claims it's not supported, try uninstalling the device in Device Manager and scanning for hardware changes. Sometimes Windows installs a generic driver that doesn't support access point mode, and replacing it with a genuine one from Intel, Realtek, or Qualcomm solves the problem.

⚠️ Note: On some enterprise builds of Windows or tablet versions, virtual network creation features may be blocked by group security policies.

Configuring access point settings

After confirming hardware compatibility, the configuration phase begins. You'll need to create a name for your future network and set a secure password. The network name (SSID) will appear in the list of available connections on smartphones and other laptops, so it should be recognizable.

To configure, enter the following command in the command line: netsh wlan set hostednetwork mode=allow ssid=MyNetwork key=MyPassword123. In this syntax ssid — is the name of the network, and key — Access password. The password must be at least 8 characters long, otherwise the system will return an error.

You can use any letters and numbers in the username and password, but avoid special characters, which may be misinterpreted by the command line. After entering the command, the system will confirm successful modification of the stored network settings. The adapter is now ready for use, but the network itself is not yet running.

It's important to note that these settings are saved in the system. You don't need to enter the configuration command every time you reboot your computer; you only need to activate the network itself. This greatly simplifies reusing the created configuration.

Starting Wi-Fi distribution and network management

Once the parameters are set, we proceed directly to launching. To activate the access point, enter the command netsh wlan start hostednetworkIf everything went well, you'll see a message indicating that the hosted network has started. At this point, your device will begin broadcasting a Wi-Fi signal.

The distribution process is controlled by three basic commands, which are useful to remember or write down. These allow you to not only start but also stop the network, as well as view its current status, without having to check the list of connected devices through the graphical interface each time.

  • 🚀 netsh wlan start hostednetwork — launches a virtual access point.
  • 🛑 netsh wlan stop hostednetwork - stops Wi-Fi distribution.
  • 👁️ netsh wlan show hostednetwork — shows the status, name, password and list of connected clients.

Using the status command is especially useful for finding out how many devices are connected to your network and their MAC addresses. This helps you monitor traffic and identify rogue users if you suspect your password has been compromised.

☑️ Network launch algorithm

Completed: 0 / 4

Setting up Internet sharing

Running the command itself netsh Creates only a local wireless network. Computers and phones connected to it won't have internet access until you set up network address translation (NAT). To do this, you'll need to go to the classic network connections window.

Press the key combination Win + R, enter ncpa.cpl and press Enter. The "Network Connections" window will open. Find the adapter your computer uses to connect to the internet (this could be Ethernet, PPPoE, or your primary Wi-Fi). Right-click it, select "Properties," then go to the "Access" tab.

Check the box next to "Allow other network users to connect through this computer's Internet connection." In the "Home networking connection" drop-down list, select the virtual adapter, usually named "Local Area Connection*" with a number or "Local Area Connection*." This is the adapter created by the system when you start the hosted network.

Parameter Meaning / Action Note
Launch command netsh wlan start hostednetwork Admin rights required
The Path to Networks ncpa.cpl Call via "Run"
Access tab Properties -> Access For main adapter only
Virtual adapter name Wireless network connection * The star is a number

After applying the settings, it's recommended to restart Wi-Fi sharing using the stop/start command. Now devices connected to your access point should automatically receive IP addresses and be able to access the web.

⚠️ Important: If the Internet on the main computer is lost after enabling Internet sharing, try temporarily disabling your antivirus or firewall, as they may be blocking packet forwarding.

Automating the process via a BAT file

Entering commands into the console every day can quickly become tedious, especially if you regularly use your laptop to share your internet connection. To make life easier, you can create a special batch file (.bat) that will perform all the necessary actions with a single click.

Create a text file on your desktop, open it and paste the following code into it:

@echo off

netsh wlan set hostednetwork mode=allow ssid=MyWiFi key=SecretPass123

netsh wlan start hostednetwork

pause

Save the file with the extension .bat, For example start_wifi.batNow, to start the network, simply run this file as administrator. Similarly, you can create a file to stop the network by replacing the command start on stop.

This approach not only saves time but also minimizes the risk of typos when entering a password or network name. You can share these files with colleagues or use them on multiple devices by editing the settings first.

📊 How often do you have to share Wi-Fi from your laptop?
Daily
Once a week
Only on trips
Never, there is a router

Solutions to common errors

Despite the simplicity of this method, users often encounter technical issues. One of the most common errors is "The hosted network could not be started. The group or resource is not in the correct state." This usually indicates a driver or WLAN service conflict.

Try restarting the WLAN AutoConfig service (WlanSvc). Open Services (services.msc), find this service in the list, right-click it, and select Restart. Also, in the service properties, make sure the startup type is set to Automatic.

Another issue is that connected devices aren't receiving an IP address or aren't able to access the internet. In this case, check if the virtual adapter index has changed in Network Connections. If you updated your Wi-Fi drivers, Windows may have created a new virtual adapter, and "Sharing" remains on the old, inactive one.

If all else fails, try completely uninstalling the wireless driver through Device Manager and reinstalling it. Sometimes, accumulated configuration errors can prevent emulation mode from working correctly, and a clean driver installation resolves the issue.

Why does the netsh wlan start hostednetwork command return error 5?

Error 5 means "Access Denied." This occurs if you didn't run the command prompt as an administrator. It could also be blocked by an antivirus or if the current user account lacks permissions.

Is it possible to distribute Wi-Fi if the laptop itself is connected via Wi-Fi?

Yes, this is possible if the network card supports simultaneous operation in both modes. However, the connection speed may be lower since the channel will be divided between receiving and transmitting data on the same frequency.

How many devices can be connected to such an access point?

Theoretically, the standard allows for connecting up to 100 devices, but the actual number depends on the power of your Wi-Fi adapter and processor. For stable operation, no more than 5-7 active clients are recommended.