Forked from Mithrandir0x/disable_wifi_hotspot.bat
Last active
February 9, 2016 13:34
-
-
Save Rillke/df69f0dfc3fbce01784d to your computer and use it in GitHub Desktop.
Two little batch files to create a cozy WiFi hotspot from the laptop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
ECHO Setting up or shutting down a hosted network | |
SET /P ACTION="ENABLE [E] DISABLE [D] INFO[I]: " | |
IF /I "%ACTION:~,1%" EQU "E" GOTO enable | |
IF /I "%ACTION:~,1%" EQU "D" GOTO disable | |
IF /I "%ACTION:~,1%" EQU "I" GOTO info | |
GOTO unknown | |
:enable | |
SET DEFAULT_SSID=rillke's hotspot | |
SET DEFAULT_PASS=MUST_BE_SET_TO_SOMETHING_REALLY_SECURE | |
SET SSID=%DEFAULT_SSID% | |
SET PASS=%DEFAULT_PASS% | |
SET /P SSID="Enter WiFi SSID [%DEFAULT_SSID%]: " | |
SET /P PASS="Enter WiFi password [%DEFAULT_PASS%]: " | |
IF /I "%SSID%" == "" ( | |
SET SSID=%DEFAULT_SSID% | |
) | |
IF /I "%PASS%" == "" ( | |
SET PASS=%DEFAULT_PASS% | |
) | |
netsh wlan set hostednetwork mode=allow ssid="%SSID%" key="%PASS%" | |
timeout 1 | |
netsh wlan start hostednetwork | |
ECHO You can now connect to the hosted network. | |
ECHO SSID: %SSID% | |
ECHO PASS: %PASS% | |
SET SSID= | |
SET PASS= | |
ECHO If you also would like to share the internet connection, you need to do so | |
ECHO from the network with internet connection (Right click -> Properties -> Share) | |
ECHO with the newly created hosted network (usually WiFi conncetion 2 or similar) | |
timeout 4 | |
ncpa.cpl | |
GOTO exit | |
:disable | |
netsh wlan stop hostednetwork | |
timeout 3 | |
netsh wlan set hostednetwork mode=disallow | |
GOTO exit | |
:info | |
netsh wlan show hostednetwork | |
netsh wlan show hostednetwork setting=security | |
ECHO Connected clients | |
arp -a | findstr -i replace_with_the_ip_to_filter_with | |
GOTO exit | |
:unknown | |
ECHO Unknown command. | |
:exit | |
ECHO Bye. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment