Wi-Fi Sharing via Command Line: A Complete Guide with Command Examples

Why share Wi-Fi via the command line if there is a graphical interface?

At first glance, creating an access point through Windows Settings or Control Panel It seems simpler - a couple of clicks and you're done. But the command line (CMD) gives you something that the graphical interface doesn't have: flexibility of settings, the ability to automate via scripts and access to advanced network parameters. For example, only through netsh you can ask Wi-Fi channel manually to avoid interference from neighboring networks, or limit the number of connected devices.

Another plus is - stabilityThe Windows graphical interface sometimes "glitches": the access point suddenly disconnects, settings are not saved, or the ability to change the network name disappears. Commands netsh They work directly with the adapter driver, bypassing abstraction layers, which reduces the risk of failures. This is critical if you're setting up distribution on a server, micro-PC, or other device. Intel NUC or a device without a screen (for example, Raspberry Pi with Windows 10 IoT).

Finally, knowing the commands will come in handy in emergency situations:

  • 🔌 No access to the graphical interface (screen broken, remote connection via RDP).
  • 🛡️ The virus blocked Control Panel, But CMD is starting.
  • 📶 You need to quickly deploy a network on several PCs using a template (for example, for a temporary office).

Preparing the system: checking compatibility and permissions

Before entering commands, make sure your computer is physically capable Share Wi-Fi. To do this:

  1. Check the adapter. Not all network cards support the mode. SoftAP (Software Access Point). Open device Manager (devmgmt.msc), find the section Network adapters and check the model. The title should mention Wireless, Wi-Fi or 802.11 (For example, Intel Wi-Fi 6 AX200 or Qualcomm Atheros QCA9377).
  2. Update your driver. Outdated drivers are the main cause of distribution errors. Download the latest version from the manufacturer's website (not through Windows Update!).
  3. Launch CMD from the administrator. Without team administrator rights netsh won't work. Click Win + X and select Terminal (Administrator) or Command Prompt (Administrator).

To check the mode support SoftAP, enter the command:

netsh wlan show drivers

Find the line in the output Hosted network support (Hosted Network). If it says there Yes — we can continue. If No - update the driver or use an external Wi-Fi adapter (for example, TP-Link TL-WN725N).

📊 What Wi-Fi adapter do you have?
Built into the laptop
External USB adapter
PCI-e card for PC
Don't know

Basic command: Create and start an access point

Now let's get to the practical part. The entire setup comes down to two commands: one creates the network configuration, the other launches it. Here's the basic template:

netsh wlan set hostednetwork mode=allow ssid="Network_name" key="Password" keyUsage=persistent

Let's look at the parameters:

  • mode=allow — enables hosted network mode.
  • ssid="..." — network name (in Latin, without spaces or special characters).
  • key="..." — password (minimum 8 characters).
  • keyUsage=persistent - saves the password after reboot.

Example command for network MyHotspot with a password 12345678:

netsh wlan set hostednetwork mode=allow ssid=MyHotspot key=12345678 keyUsage=persistent

Once the configuration is created, start the network:

netsh wlan start hostednetwork

If after this command you see the error "Failed to start the hosted network", check: 1) administrator rights, 2) support for the mode Hosted Network driver, 3) conflicts with antivirus software (for example, Kaspersky or Avast may block distribution).

The adapter supports Hosted Network|CMD is running as administrator|Driver updated|Antivirus temporarily disabled-->

Setting up Internet sharing

Launching an access point is only half the battle. For connected devices to access the internet, you need to allow connection sharingTo do this:

  1. Open Control PanelNetwork and InternetNetwork and Sharing Center.
  2. Click Changing adapter settings.
  3. Find the connection through which your PC receives the Internet (for example, Ethernet or Wireless network for a USB modem). Right-click → Properties → tab Access.
  4. Check the box Allow other network users to use this computer's Internet connection.
  5. From the drop-down list, select the connection you created (usually it is called Local Area Connection* X, where X is a number).

Important: If you are distributing the Internet with Wi-Fi (for example, via a USB modem) rather than via a cable, a conflict may occur. In this case:

  • 🔄 Disable the primary Wi-Fi on your PC before starting the hotspot.
  • 📡 Use a cable connection (if possible) for stability.

After applying the settings, restart the access point:

netsh wlan stop hostednetwork

netsh wlan start hostednetwork

Advanced settings: channel, number of devices, network name

Basic commands create a network with default settings, which aren't always optimal. For example, Windows automatically selects a Wi-Fi channel, but this may overlap with channels of neighboring networks, causing interference. To manually set the channel, use:

netsh wlan set hostednetwork channel=6

Valid channel values: 1–14 (for the 2.4 GHz band). For 5 GHz, the range is wider, but not all adapters support it. To find out available channels, use utilities like WiFi Analyzer (Android) or inSSIDer (PC).

By default, Windows limits the number of connected devices to 10–15 (depending on the driver). To increase the limit, you will need to edit the registry. Attention: Incorrect changes to the registry can lead to system failures!

⚠️ Warning: Before editing the registry, create a system restore point (rstrui.exe). Not all adapters support more than 20 connections simultaneously, even after editing the registry.

Open regedit and follow the path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Create a new parameter DWORD (32-bit) with a name DefaultUserLimit and meaning 50 (maximum). After a reboot, the limit will increase.

If you need to change the network name (SSID) or password without completely re-creating the configuration, use the same command set hostednetwork with new parameters. For example:

netsh wlan set hostednetwork ssid="NewNetworkName" key="NewPassword123"
Parameter Description Example of meaning
channel Wi-Fi channel (1–14 for 2.4 GHz) 6 or 11
ssid Network name (up to 32 characters) MyOfficeWiFi
key Password (minimum 8 characters) SecurePass2026!
keyUsage Saving password after reboot persistent

Troubleshooting: What to do if the network won't start

Even with the correct commands, Wi-Fi sharing may not work. Here are common errors and their solutions:

  • 🚫 Failed to start the hosted network. The group or resource is not in the correct state to perform the requested operation.
    Cause: the adapter does not support Hosted Network or the driver is damaged.
    Solution: Update the driver manually (download from the manufacturer's website, not through device Manager).
  • 🔌 Failed to start the hosted network. The device or resource is busy.
    Cause: conflict with other software (antivirus, VPN, virtual machines).
    Solution: Temporarily disable your antivirus and repeat the command.
  • 📡 The network starts, but there is no internet on connected devices.
    Cause: IP sharing or conflict is not configured.
    Solution: Check your sharing settings (see section above) and restart your network.

If the problem persists, reset your network settings:

netsh winsock reset

netsh int ip reset

ipconfig /flushdns

After this, restart your PC and repeat the setup.

⚠️ Note: On some laptops (e.g. Lenovo or HP) The Wi-Fi adapter may be disabled in the BIOS/UEFI. Check the settings. Wireless LAN in BIOS and enable it if it is disabled.
How can I check if the distribution is working?

Connect another device (smartphone, tablet) to the network. If your device is visible in the list of networks SSID, but you can't connect—the problem is with the password or security settings. If the network isn't visible at all, the adapter hasn't switched to the default mode. SoftAP (check driver).

Automation: Creating a Quick Start Script

To avoid entering commands manually each time, create bat file. Open Notebook and paste the following code:

@echo off

:: Network creation

netsh wlan set hostednetwork mode=allow ssid="MyAutoHotspot" key="Password123" keyUsage=persistent

:: Network launch

netsh wlan start hostednetwork

:: Pause to see the result

pause

Save the file with the extension .bat (For example, start_wifi.bat). Now just double-click on it (as administrator), and the network will start automatically.

For network stops create a separate file:

@echo off

netsh wlan stop hostednetwork

pause

If you want the network to start when Windows starts, place a shortcut .bat-file to folder Autoload (shell:startup). But keep in mind: for this Command line must run with administrator rights automatically, which requires additional settings in Task Scheduler.

For advanced users, you can add a network status check and automatic restart in the event of a failure to the script. Example:

@echo off

:loop

netsh wlan show hostednetwork | find "Hosted network started" > nul

if %errorlevel% equ 0 (

echo The network is working normally.

) else (

echo Restarting network...

netsh wlan stop hostednetwork

netsh wlan start hostednetwork

)

timeout /t 60 >nul

goto loop

This script checks the network status every minute and restarts it if it goes down.

FAQ: Answers to frequently asked questions

Is it possible to share Wi-Fi via the command line on Windows 7?

Yes, teams netsh wlan They also work in Windows 7, but with limitations:

  • Support Hosted Network depends on the driver (many adapters for Win7 do not support this mode).
  • There is no automatic assignment of IP addresses (you will have to configure DHCP manually or use static addresses).
  • The maximum number of connected devices is often limited to 5–8.

For Win7 it is better to use third-party utilities like Connectify or Virtual Router Plus.

How to change a network password without recreating it?

Use the same command set hostednetwork, but specify only the new password:

netsh wlan set hostednetwork key="NewPassword123"

After this, restart the network:

netsh wlan stop hostednetwork

netsh wlan start hostednetwork

All connected devices will be disconnected and will require you to re-enter your password.

Why is the internet speed via tethering lower than on the main PC?

This is a normal phenomenon and is related to:

  • Hardware limitations adapter (for example, Intel Wireless-AC 9560 in mode SoftAP works slower than in normal mode).
  • Overhead costs to encrypt traffic (especially when using WPA2-PSK).
  • Competition for resources (the adapter simultaneously receives and distributes data).

To improve speed:

  • Use the channel 5 GHz (if the adapter supports it).
  • Reduce the number of connected devices.
  • Disable background downloads on your main PC (torrents, updates).

Is it possible to share Wi-Fi from a PC that is itself connected to Wi-Fi (without a cable)?

Technically yes, but this often leads to problems:

  • 🔄 Adapter conflict: The same Wi-Fi module cannot simultaneously receive and distribute a signal effectively.
  • 📉 Speed ​​drop: The bandwidth is divided between reception and transmission.
  • 🚫 Driver blocking: some adapters (eg Realtek RTL8188EE) refuse to work in this mode.

If there is no other option, try:

netsh wlan set hostednetwork mode=allow ssid=MyNet key=12345678

netsh wlan start hostednetwork

But expect unstable operation. It is better to use two adapters: one for receiving Wi-Fi, the second (USB) for distributing.

How do I check how many devices are connected to my network?

Windows doesn't have a built-in tool for monitoring devices connected to it. Hosted Network. But you can use:

  • Team arp: open CMD and enter arp -a. Look for IP addresses from the range of your distributed network (usually 192.168.137.X).
  • Third-party utilities: Wireless Network Watcher (NirSoft) or Angry IP Scanner scan the network and show all connected devices.
  • Router logs: If your PC is connected to the main router via cable, check the list of devices in the router's web interface (192.168.1.1 or 192.168.0.1).