I want to start hosted network automatically at startup.
My question is about how to make a patch file to check status of hosted network first and depending on status run a command.
Like this:
@ECHO OFF
If "netsh wlan show hostednetwork|find "Status"|find "Started"= Started Go
To End
If "netsh wlan show hostednetwork|find "Status"|find "Not Started"= Not
Started Go To Start
:start
netsh wlan start hostednetwork
goto end
:end
PAUSE
This code format is wrong. How can I write the correct patch?
How about something more simple. The FIND
command sets ERRORLEVEL to 1 if it does not find the pattern.
netsh wlan show hostednetwork | find "Status" | find "Started"
IF ERRORLEVEL 1 GOTO Start
GOTO TheEnd
:Start
netsh wlan start hostednetwork
:TheEnd
pause
EXIT /B