Every morning, I take my Acer notebook to work; in the evening, I take the notebook to class; at night, I take the notebook home. And every time I change locations, I need to reconfigure my IP settings. I don't like dynamic IP addressing; I want to know the IP address, gateway, and DNS server that I'm using whenever possible.
Certain tools (e.g., Softmate's IPSwitcher) let you select an IP configuration from several sets of configurations. However, the Netsh command achieves the same result. You can use Netsh to change your IP address, subnet mask, gateway, and DNS settings.
To configure IP settings, go to a command prompt and enter
netsh interface ip set address name="local area connection" source=static 10.2.2.2 255.0.0.0 10.200.0.3 1 netsh interface ip set dns "Local area connection" static 10.2.2.2
The first Netsh command configures the local area connection settings. This command sets the IP address to 10.2.2.2, subnet mask to 255.0.0.0, gateway to 10.200.0.3, and gateway metric to 1. The second Netsh command sets the Preferred DNS Server setting to 10.2.2.2.
I used the Microsoft Windows 2000 Server Resource Kit's Choice command to create a batch file to retrieve user input and the Netsh command to modify the IP settings according to that input. Listing 1 shows my batch file. The menu.txt file, which Listing 2 shows, contains my selection menu.