@echo off

echo Enter Your Choice
echo (1) Create Wifi Hotspot
echo (2) Stop Wifi Hotspot
echo.

:choices
set /p choice=
if %choice%==1 goto 1
if %choice%==2 goto 2
if not %choice%==1 (
echo Invalid input. Try again.
goto choices
)

:1
echo.
echo Enter Wifi Network ID:
set /p wifiName=
:password
echo Enter Wifi Password:
echo (minimum of 8 characters of only numbers and/or letters)
set /p wifikeyPass=
if defined wifikeyPass if "%wifikeyPass:~7,1%"=="" (
echo Password is below 8 characters, input password again.
goto password
)
netsh wlan set hostednetwork mode=allow ssid=%wifiName% key=%wifikeyPass%
netsh wlan start hostednetwork

:toStop
echo Do you wish to stop the network? (Y/N)
set /p choiceAgain=
if %choiceAgain%==Y goto 2
:toExit
if %choiceAgain%==N goto exiting
if not %choiceAgain%==Y (
echo Invalid input. Try again.
goto toStop
)
pause
exit

:2
echo.
netsh wlan stop hostednetwork
pause
exit


:exiting
echo Do you wish to exit now? (Y/N)
set /p choice2=
if %choice2%==Y exit
if %choice2%==N goto toStop
if not %choice2%==Y (
echo Invalid input. Try again.
goto toExit
)