Shyam Sunder Nishad
How to set up Wi-Fi hotspot (not Ad-Hoc) in Windows 7, 8 and 10 with WPA2-PSK Security


Switch on Wifi in your PC and open command line as administrator.
  1. Execute the following command

    netsh wlan set hostednetwork mode=allow ssid=alpha key=beta1234


    This will set up a virtual wifi network which can be seen in "Network Adapter Settings" in control panel. But it will show up as "not connected".
  2. To start connection, execute

    netsh wlan start hostednetwork


  3. To stop the connection, you can execute

    netsh wlan stop hostednetwork


Note that, due to the settings in step 1, your hotspot will be detected with the name "alpha". To connect it, the password is "beta1234". You can change these two things according to your wish. But you need to keep the password (key) with atleast 8 characters.

For ease, you can make two batch scripts as follows -

  1. Create a new text file.
    Make sure that file extension name is set to visible in the folder options. Otherwise, you will make .txt files and not .bat files.
    Rename the file to "start-hotspot.bat" .
    Copy the command in step 2.
  2. Similarly, make a file with name "stop-hotspot.bat" . Copy the command in step 3.
  3. In case, you want to download them, you can find them here.

Now to start the hotspot, just right click on first file and "run as administrator" .
To stop, just double click on second file.

One thing to add here is that, in order to connect to internet, you have to enable internet connection sharing. To do that right click on Wired LAN/Wireless LAN (whichever adapter is connected to internet), and open properties. In the sharing tab, check the first option. Then select Microsoft Hosted Network Virtual Adapter.