Quickly switching network connection in Windows XP
A lot of people uses the same notebook to access Internet from many places or networks. For example from home and office. If all these networks are using DHCP-assigned IP addresses and network parameters or if you’re using different medium (i.e. One at home, wireless at work) then there is no problem. However, if both networks uses static parameters over the same medium, then the only option you’re left is manually changing network parameters, as Windows does not allow you to create more than one connection for single hardware (network medium). Hopefully, you can easy your life with a set of simple batch scripts.
First, you need to know an exact name of your connection, which parameters you want to change using batch scripts. If you don’t remember this, then a visit to “Network connections” applet in Control Panel is necessary. If network connection name is two words or longer, you must change it to single-word for this trick to work.
Next, prepare batch files in number equal to number of networks, you’re going to use with the same laptop.
To set fixed connection parameters use following script:
@echo off netsh interface ip set address name="One" source=static addr=192.168.1.7 mask=255.255.255.0 gateway=192.168.1.1 1 netsh interface ip set dns name="One" static addr=22.214.171.124 primary netsh interface ip add dns name="One" addr=126.96.36.199 index=2
One with your actual connection name, as found in Control Panel. Replace my example parameters given in
gateway with your own network’s values (IP address, network mask, default gateway and two DNS addresses respectively).
To set DHCP-based connection use following script instead:
@echo off netsh interface ip set address name="One" source=dhcp netsh interface ip set dns name="One" source=dhcp
One with your actual connection name.
Save these files in any handy location (desktop, root folder etc.) and test it by double-clicking each of them.
Changing network connection’s parameters using batch file may take some time, even up to few minutes and that is perfectly normal. Whenever process is completed successfully, you should see
OK messages in console window displayed as many times as
netsh you have in your batch file (three in first example and two in second one). Next, console window should close itself.
In case of any error or problem you’ll see proper error message and console window will not auto-close.
Above mentioned solution is verified and surely works. At least under Windows XP in Polish edition. I’ve been using it successfully for past few months. If something is wrong in your case, then you most likely have some typo or mistake in your batch file.