Skip to content

Instantly share code, notes, and snippets.

@mildronize
Created March 6, 2016 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mildronize/8d159d35497c56368914 to your computer and use it in GitHub Desktop.
Save mildronize/8d159d35497c56368914 to your computer and use it in GitHub Desktop.
A script for creating a hotspot wifi on Windows (Require Admin permission)
@ECHO OFF
echo Hotspot
echo .
set wirelessName=Hotspot
IF "%1"=="start" goto START
IF "%1"=="stop" goto STOP
IF "%1"=="restart" goto RESTART
IF "%1"=="stat" goto STAT
set /p name=What is Adhoc name ? (Press S to stop):
IF "%name%"=="S" goto STOP
IF "%name%"=="" goto START
:SET
echo Start adhoc!
set /p pass=Password ? :
netsh wlan set hostednetwork mode=allow ssid="%name%" key=%pass%
netsh wlan start hostednetwork
netsh interface ip set address name="%wirelessName%" source=dhcp
goto EXIT
:START
echo Starting hotspot!
netsh wlan start hostednetwork
goto EXIT
:STOP
echo Stopping hotspot!
netsh wlan stop hostednetwork
goto EXIT
:RESTART
echo Restarting hotspot!
netsh wlan stop hostednetwork
netsh wlan start hostednetwork
goto EXIT
:STAT
netsh wlan show hostednetwork
goto EXIT
:EXIT
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment