Windows wireless network changing batch script
March 2, 2011 – 00:21I had a need to write a batch (.bat) script under windows to change the wireless network that the computer is connected to.
The script is very simple and requires writing permission on C: drive but you can change the folder if you want. You also need to make sure that network profiles are already defined (i.e. you were once successfully connected to the networks provided).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | @echo off cd c:\ set net1=name_of_network_1 set net2=name_of_network_2 set net3=name of network 3 set /p net0= <net if "%net0%"=="%net1%" ( echo %net3%>net set net=%net3% ) else ( if "%net0%"=="%net2%" ( echo %net1%>net set net=%net1% ) else ( echo %net2%>net set net=%net2% ) ) netsh wlan disconnect netsh wlan connect "%net%" |
It can be used for example if one of the wireless networks is down.
You can use it in other situations, when you need a different routing or a different IP address (e.g. jDownloader).
