Tuesday, July 07, 2009

Connect to wireless network using netsh

If you kinda tired of constantly changing your wireless network when you're at home or office, batch file could be a great help for you. A single click is enough to setup your wireless connection. I was using Net Profiles and I'm a satisfied user, but this single click idea beats Net Profiles.
Of course you've to create a batch file for each connection you want to setup, but that's not too much to do (imho).

FYI, I'm using Vista. For XP, the command could be a bit different but the idea is still the same (c'mon improvise).

Now, here's the simple command line to connect to a wireless lan:
netsh wlan connect name="network name" interface="Connection name under Manage Network Connection" ssid="the ssid"

example:
netsh wlan connect name="hpsetup" interface="Wireless Network Connection" ssid="hpsetup"

in case you use static ip in your office or home, the command goes like this:
netsh interface ipv4 set address "Connection name under Manage Network Connection" static the_static_ip mask the_gateway

example:
netsh interface ipv4 set address "Wireless Network Connection" static 192.168.1.102 255.255.255.0 192.168.1.103


One more thing, running under Vista you need to run the batch file as administrator.

After all, it's only one click away.....