Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Switch between Wi-Fi Networks

Aug
1,933
71
Further to http://jpsoft.com/forums/threads/programmatically-determine-which-network-connected-to.5331/, here are some .btm's I've created to switch between, and identify, different Wi-Fi networks.

android.btm
Code:
@setlocal
@echo off
iff %# eq 0 then
 echo USAGE: android on
 echo        android off
 quit
endiff
iff %1 eq on then
 netsh wlan connect name=AndroidAP2040
endiff
iff %1 eq off then
 netsh wlan disconnect
endiff
endlocal

wind.btm
Code:
@setlocal
@echo off
iff %# eq 0 then
 echo USAGE: wind on
 echo        wind off
 quit
endiff
iff %1 eq on then
 netsh wlan connect name=WIND-E486Es-32f8
endiff
iff %1 eq off then
 netsh wlan disconnect
endiff
endlocal

I have also added code to my post_exec.btm to display the current Wi-Fi network in use on the statusbar...

Code:
@echo off
set ssid=%@execstr[8,netsh wlan show interfaces]
set ssid=%@word[2,%ssid]
if %@len[%ssid] gt 0 set stattext=%ssid
if %@len[%ssid] eq 0 set stattext=Not Connected To Wireless Network
if not defined hebrew call hebrew.btm
if defined hebrew set stattext=%hebrew` `%stattext
statusbar %stattext
unset stattext
unset ssid

...which is called via the post_Exec alias;

Code:
post_exec=c:\utils\post_exec.btm

Joe
 
The following command will display the "Connect to a Network" window in Microsoft Vista;

Code:
RunDll32.exe van.dll,RunVAN

I am posting this mainly for my future reference, and also for anyone else who may find it useful.

Joe
 
Back
Top