1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Switch between Wi-Fi Networks

Discussion in 'T&T - Scripting' started by Joe Caverly, Dec 17, 2013.

  1. Joe Caverly

    Joined:
    Aug 28, 2009
    Messages:
    661
    Likes Received:
    8
    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
     
  2. Joe Caverly

    Joined:
    Aug 28, 2009
    Messages:
    661
    Likes Received:
    8
    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
     

Share This Page