Windows wireless network changing batch script

I 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).

@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
	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).

This entry was posted in Win and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *