Share internet via wifi using command line

Asked

Viewed 353 times

2

I have a wifi adapter, or could be a notebook, and I share the internet via Wifi, that’s not the problem, follows below how I create a wifi network:

Create a wifi network

  1. Access CMD as administrator;
  2. netsh wlan set hostednetwork mode=allow ssid=nomeHost key=senha
  3. netsh wlan start hostednetwork

With these steps I leave the wifi network to connect, and to give access Internet via network, control panel access > network and internet > Network connection.

After that, in the cable network properties, the default, usually "Ethernet", in the sharing tab, select the first and option 2, and in the Home Connection select the local connection that was created by the command, usually "Local Connection*", something like that.

Problem:
I would like to perform the sharing steps via command line, because sometimes during the day I need to restart, because it simply stops working.

If someone at least knows what I can use, some windows component. I don’t want programs that do it for me, I want to do it myself.

  • For me this question is outside the scope, because it has more to do with operating system configuration than network itself.

  • @Articuno, read "a software algorithm" windows by being an OS, so it is a software, so it is within the scope.

  • 1

    For me it is a valid question, using command line means that it is possible to use code, programs to perform operations (such as using a php script to share a wifi), imagine that I am programming a prepaid wifi server for an institution for example. In addition I believe that it is necessary to reflect on the arguments of Gabe: https://pt.meta.stackoverflow.com/questions/1/aqui-n%C3%83o-%C3%89-o-stackoverflow-com

  • 3

    That’s Shell Script programming, for me it’s within the scope, but you know how it is :)

  • wikipedia can help you https://pt.wikipedia.org/wikiShell_script @David

1 answer

3

Before you know what a shell script is, it’s important to know the who is a Shell.

You will have to create a *.bat file and add these commands to the file:

netsh wlan set hostednetwork mode=allow ssid=nomeHost key=senha
netsh wlan start hostednetwork

on windows startup, this will depend on the version of windows you are using, How to automatically run a BAT file when turning on the computer

All the things you want to do to connect share and see network you can add the commands in this file *.bat How to create a batch file.

  • 1

    You can give -1 but I’m sure my answer helped the author of the question :)

  • 2

    I think the doubts of AP are precisely about which commands it should put inside the file.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.