- Aug
- 2,033
- 82
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
wind.btm
I have also added code to my post_exec.btm to display the current Wi-Fi network in use on the statusbar...
...which is called via the post_Exec alias;
Joe
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