Sharing Wi-Fi from a Laptop Using CMD: A Complete Guide with Commands and Tips

You can turn your laptop into a full-fledged Wi-Fi access point without any third-party programs – just a few commands in Windows command lineThis method works on all OS versions from Windows 7 to Windows 11 (including Windows 10 22H2), does not require administrator rights on the network and allows for flexible configuration of connection parameters. But why exactly CMD, if there's a graphical interface? It's all about stability: the command line gives you more control over the process and helps diagnose errors that often go unnoticed in the default settings.

In this article you will find not only step-by-step instructions with current commands, but also table of common mistakes with solutions, security tips (including encryption WPA2-PSK), as well as answers to questions about upload speed and device compatibility. If you've ever encountered a problem with your smartphone not seeing your laptop's network or the connection constantly dropping, here's how to fix it.

Preparing your laptop for Wi-Fi sharing

Before you start using commands, make sure your laptop meets two key requirements:

  • 🔹 Wi-Fi adapter must support the regime Hosted Network (virtual access point). You can check this with the command netsh wlan show drivers — look for the line Hosted network support: yes.
  • 🔹 Adapter drivers updated to the latest version. Outdated drivers are the cause of 70% of distribution errors. To check the version, use Device Manager → Network Adapters → Properties of your Wi-Fi module.

If your adapter does not support Hosted Network (for example, some models from Broadcom or old ones Intel), the alternative will be to use USB modem or update the drivers through the manufacturer's official website. Also, check if the adapter itself is turned on—sometimes it turns off. Device Manager or via the laptop's function keys (for example, Fn + F2 on ASUS or Lenovo).

📊 What type of connection are you planning to distribute?
Ethernet (cable)
3G/4G modem
Other Wi-Fi connection
Don't know

Basic commands for starting an access point

The entire setup process comes down to two key commands: creating a network and starting it. Open command prompt as administrator (click Win + XTerminal (administrator)) and enter the commands in order:

  1. Network creation (set your name and password):
    netsh wlan set hostednetwork mode=allow ssid="MyWiFi" key="Password123" keyUsage=persistent

    Here:

    • ssid="MyWiFi" — the name of your network (can be replaced with any).
    • key="Password123" — password (minimum 8 characters, case sensitive).
    • keyUsage=persistent - saves settings after reboot.
  • Network launch:
    netsh wlan start hostednetwork
  • After running the second command, your access point should appear in the list of networks on other devices. If this doesn't happen, check the network status with the command:

    netsh wlan show hostednetwork

    Look for the line in the answer Hosted network status: running. If the status not running, proceed to the Troubleshooting section.

    Make sure your Wi-Fi adapter is enabled|Update adapter drivers|Check for Hosted Network support|Run CMD as administrator|Set a password ≥8 characters long-->

    Setting up Internet sharing

    The created network will distribute the Internet only if you manually allow it. public access to the main connection. To do this:

    1. Open Control Panel → Network and Sharing Center → Change adapter settings.
    2. Find your primary connection (eg. Ethernet or Wireless network), right-click on it → Properties.
    3. Go to the tab Access and check the box Allow other network users to use this computer's Internet connection.
    4. In the drop-down list Connecting a home network select the network you created (it will be called Wireless network connection* X, where X is a number).
    5. A critical detail: If you're distributing Wi-Fi while connected to another Wi-Fi network (for example, via a repeater), an IP address conflict may occur. In this case, disable the protocol in the primary connection's properties. IPv6 and manually set a static IP for the shared network.

      Security: How to Protect Your Network

      By default, a network created through CMD, uses encryption WPA2-PSK — This is a reliable standard, but its effectiveness depends on the complexity of the password. Avoid simple combinations like 12345678 or qwertyui, since they can be selected in a few minutes using specialized programs (for example, Aircrack-ng). Optimal password:

      • 🔐 Length must be at least 12 characters.
      • 🔤 A combination of uppercase and lowercase letters, numbers, and special characters (e.g. WiFi@Home_2026!).
      • 🔄 Regular change (once every 1–2 months).

    Additional security measures:

    Threat Solution Command/Action
    Connecting unknown devices Limit the number of connected gadgets netsh wlan set hostednetwork maxclients=5 (maximum 5 devices)
    Traffic interception Disable the protocol WPS (vulnerable to brute force) In the router settings (if you are distributing its Wi-Fi) or through regedit
    DNS attacks Use secure DNS (e.g. Cloudflare) netsh interface ip set dns "Wireless Network Connection* X" static 1.1.1.1

    It is also recommended to disable Wi-Fi sharing when not in use using the command:

    netsh wlan stop hostednetwork

    Common errors and their solutions

    Even if you enter the commands correctly, the network may not start. Here top 5 mistakes and ways to eliminate them:

    Error Cause Solution
    Failed to start the hosted network. The group or resource is not in the correct state to perform the requested operation. The adapter does not support Hosted Network or the drivers are outdated. Update your drivers manually through the manufacturer's website (not through device Manager!).
    The network is visible, but there is no internet access. IP sharing or conflict is not configured. Check your sharing settings (section 3) and follow the steps below ipconfig /releaseipconfig /renew.
    The network disconnects periodically. Power saving turns off the adapter. Open Device Manager → Network Adapters → Your Wi-Fi Properties → Power Management and uncheck the box Allow the computer to turn off this device to save power.
    Invalid SSID or key. The network name or password contains invalid characters (e.g. Cyrillic, spaces at the beginning/end). Use only Latin characters, numbers and symbols _-!.

    If the problem is not resolved, please check Windows Event Log on errors related to WLAN:

    eventvwr.msc → Windows Logs → System → Filter current log (look for events with source Microsoft-Windows-WLAN-AutoConfig)
    What to do if the netsh command does not work at all?

    If after entering any command with netsh you see a message "netsh" is not recognized as an internal or external command., this means that the system files are damaged. Restore them using DISM And SFC:

    1. DISM /Online /Cleanup-Image /RestoreHealth
    2. sfc /scannow

    Please try again after rebooting.

    Speed ​​and stability optimization

    Wi-Fi distribution speed via a laptop will always be lower than that of a dedicated router, but it can be improved:

    • 📶 Wi-Fi channelBy default, Windows selects a channel automatically, but it may be overloaded. Check the channel load with the program WiFi Analyzer (Android) or inSSIDer (Windows) and manually set a free channel:
      netsh wlan set hostednetwork channel=6
    • 🔧 Adapter operating mode: If your adapter supports 802.11n/ac, force it to turn on to increase speed:
      netsh wlan set hostednetwork mode=allow ssid="MyWiFi" key="Password123" keyUsage=persistent type=ac
    • 🖥️ CPU loadWi-Fi sharing consumes CPU resources. Close background programs (especially torrents and streaming services) to ensure stability.

    To test the speed use Speedtest.net on the connected device. If the speed is below 50% of the original, check:

    1. Don't you use USB 2.0-modem (limit ~300 Mbit/s).
    2. Is power saving mode enabled in the adapter settings?
    3. Is the laptop in a Wi-Fi dead zone (for example, next to a microwave or a mirror?)

    Automate network startup when you turn on your laptop

    To avoid entering commands every time, create bat file To automatically start the network:

    1. Open Notebook and paste:
      @echo off
      

      netsh wlan start hostednetwork

      echo Access point started!

      pause

    2. Save the file with the extension .bat (For example, start_wifi.bat).
    3. Put it in startup: click Win + R → enter shell:startup → move the file to the folder that opens.

    To stop the network, create a similar file with the command netsh wlan stop hostednetworkIf the network does not start automatically, check if the service is enabled. Autoconfiguration Wireless LAN (services.msc).

    FAQ: Answers to frequently asked questions

    Is it possible to share Wi-Fi from a laptop if the laptop itself is connected to another Wi-Fi network?

    Technically yes, but it creates double NAT, which may cause problems with online gaming, IP telephony, or connecting to some corporate networks. Additionally, speeds will be lower due to double packet processing. If your router supports bridge mode (WDS), it's better to set it up.

    Why doesn't the network recover after sleep/hibernation?

    This is a known Windows issue related to adapter power management. Solutions:

    1. Disable hibernation with the command powercfg /h off.
    2. In the adapter settings (in Device Manager) disable the option Allow the computer to turn off this device to save power.
    3. Use a script to restart the network after waking up (can be configured via Task Scheduler).

    How to share Wi-Fi on a laptop running macOS or Linux?

    On macOS this is done through System Preferences → Sharing → Internet Sharing (select a source and create an access point). In Linux (For example, Ubuntu) use the utility create_ap:

    sudo create_ap wlan0 eth0 MyWiFi Password123

    Where wlan0 - your Wi-Fi adapter, eth0 — Internet source.

    Is it possible to share Wi-Fi without a password?

    Technically yes, if you do not specify the parameter in the network creation command key:

    netsh wlan set hostednetwork mode=allow ssid="OpenWiFi" keyUsage=persistent

    But this is extremely unsafe! Anyone connected will be able to intercept your traffic (including website passwords if they are transmitted without permission). HTTPS). If you need an open network (for example, for guests), it is better to use guest access on a router with device isolation.

    How many devices can be connected to such a network?

    The limitation depends on the adapter and Windows version:

    • Windows 7/8: up to 100 devices (theoretically), but in practice - 5-10 (after that, lags begin).
    • Windows 10/11: up to 32 devices, but no more than 15 work stably.

    To increase the limit, change the registry parameter HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\MaxUserPort (meaning - 65534), but this can lead to instability.