How to use cmd to create a Wi-Fi hotspot to connect two computers

You will learn how to connect two or more computers using the command prompt (cmd) in this article so that you can share data, participate in a game on a local area network (LAN), and do a great deal more using Wi-Fi.

In the modern world of computers, establishing a connection between two or more machines has become increasingly important. This can be done for a variety of reasons, including playing games with friends over a local area network (LAN) or sharing internet connections with those friends, among other things.

Create a Wi-Fi hotspot by using the cmd

Let's get started by learning how to use the command prompt to set up a Wi-Fi hotspot that will connect two computers without the need for any additional software. Simply using the short codes and associated numbers that are provided below at the command prompt is all that is required to set up a Wi-Fi hotspot.

To begin, we must first open the command prompt window on our system in order to perform the task of creating a Wi-Fi hotspot. I'm not sure what operating system you're using, but the first step is to open the command prompt as an administrator. For example, if you're using Windows 10, do the following:

Open the command prompt as an administrator in Windows 10

To open the command prompt as an administrator in Windows 10: press "Windows Key" and type "cmd." Here is the new outcome you will see after performing these two steps:

open cmd in windows 10 example

I used a red arrow to draw your attention to the "cmd" that I typed in my system, which causes the system to list the "command prompt" after searching the system for the text "cmd." Now you must click on the "Run as administrator" link, which I highlighted with a yellow marker and then drew your attention to with a blue arrow.

Now, let's return to the original topic, which is creating a Wi-Fi hotspot with the "cmd" command. I'm currently running Windows 7 and putting the command-line codes given in this article into practice. The above screenshot of Windows 10 was taken from another laptop that has Windows 10 as its operating system.

Open the command line and write code to create a Wi-Fi hotspot

Regardless of the operating system you're using---Windows 10, Windows 7, or another---after clicking or selecting the "open as administrator" option, a new window with the confirmation box will most likely appear on your screen. On this confirmation box, you will see a message asking, "Do you want to allow this app to make changes to your device?" Selecting "Yes" from that box is what you need to do. Your "command prompt" window will now appear on your screen. Instead of a standard command prompt, you'll see "Administrator: Command Prompt." Here's a quick rundown:

create wifi hostspot using cmd

Don't be confused by the color of the text in the preceding command prompt; you can see the same by typing "color a" and pressing the "enter key," then typing "cls" and pressing the "enter key" again.

The "color a" command turns the screen green, and the "cls" command clears the screen. You can experiment with different colors by using the commands "color b", "color c", and so on. Now let's come to the actual point. Type the following command at the command prompt:

netsh wlan set hostednetwork mode=allow ssid=codescracker key=codescracker

Instead of codescracker, you can use your own SSID and key/password. Simply press the ENTER key after typing the above commands. You have now created a Wi-Fi hotspot; now you must start it, and your command prompt will look like this:

create lan using cmd

Simply type the following command into the command prompt to start hostednetwork:

netsh wlan start hostednetwork

Simply press the ENTER key after typing the above command into the command prompt. After pressing the ENTER key, you have created a Wi-Fi hotspot with cmd. You can now access your Network and Sharing Center. Your Wi-Fi Hotspot will be created as you can see. Here is a screenshot of the created Wi-Fi hotspot, namely codescracker:

wifi hotspot created connect two computers

Tell your friend to connect with codescracker (password: codescracker), to play the game NFS, to share an internet connection via Wi-Fi, or to do anything else.

The Benefits of Using Command Over Software to Make a Wi-Fi Hotspot

Here are some advantages to creating a Wi-Fi hotspot with command-line software to connect two or more computers:

Finally, as operating systems become more feature-rich by the day, I'm not sure if, in the future, you'll be able to use these features simply by interacting with your operating system via the UI (user interface) rather than coding or using the command line.

Computer Fundamentals Quiz

« Previous Tip Next Tip »

Liked this post? Share it!