Reputation: 593
With Windows 10 is it possible to setup up known networks and be able to connect to them without all the mouse movement and click?
Upvotes: 1
Views: 70
Reputation: 593
Using Windows batch files, you can set it up to connect to networks you already know (Network1 or Network2, below) without ever touching the mouse.
@echo off
setlocal EnableDelayedExpansion
for %%i in ("Network1"
"Network2") do (
netsh wlan show networks mode=ssid | findstr /C:%%i
if !ERRORLEVEL! EQU 0 (
echo "Found %%~i - connecting..."
netsh wlan connect name=%%i
exit /b
) else (
echo "Did not find %%~i"
)
)
@echo on
Save the above to .bat and run it from cmd.exe or a program like Listary.
Some comments about the code:
for %%i
to for /F %%i
EnableDelayedExpansion
and "!" around ERRORLEVEL
are needed to keep the variable ERRORLEVEL
from being assigned
whatever it was at the beginning of the script. Since I don't
normally program Windows batch files, this is 2 hours of my life
gone that you won't have to deal with. %%
needed for variables in Windows batch files. The variable is referenced with %
at the command line.%%~i
strips the quotation marks around the string when outputting to stdout.Upvotes: 1