|
Question : Batch file (or similar) - Network Adapter Settings (IP/Gateway)???
|
|
Hi,
Trying to find a solution to my problem, but can't think how I can do it. Is there a batch file or similar that I could write to fit the following scenario?:
I use static IPs on my home network, so my WLAN NIC is configured as 10.0.0.6 with subnet whatever it is (can't remember) gateway 10.0.0.138, DNS 10.0.0.138. But if I go to use another network such as a "hotspot" more often than not my static IP setup will not be compatible. Is there anyway I can automate the process of going back to DHCP assigned settings (auto) (XP) without having to manually do it each time?
Thanks in advance.
|
Answer : Batch file (or similar) - Network Adapter Settings (IP/Gateway)???
|
|
The netsh command can be used to configure network cards/ IP's. I havent tried it with wireless cards but it should work for changing IP information. However it will not configure wireless settings such as WEP/WPA, channels etc. I have included 2 batch file examples I use for changing the IP at the click of an Icon. First is to change to a static IP and second is to change to a Dynamic IP. On my laptop I connect to about 8 different networks so I have a short cut to an netsh batch file to automatically change it for me. You might want to modify to suit your needs. Just enter contents and save as Location.bat. Each will display the new address, after adjusted. You will need to change the network connection name and parameters, but they should work fine for you.
*************************************************** rem Reset network Settings for static IP netsh interface ip set address name = "Local Area Connection" source = static addr = 10.0.0.99 mask = 255.255.255.0 netsh interface ip set address name = "Local Area Connection" gateway = 10.0.0.254 gwmetric = 1 netsh interface ip set dns name = "Local Area Connection" source = static addr = 24.222.0.91 netsh interface ip add dns name = "Local Area Connection" addr = 24.222.0.33 netsh interface ip show config pause
*************************************************
rem Reset network settings for DHCP netsh interface ip set address name = "Local Area Connection" source = dhcp netsh interface ip set dns name = "Local Area Connection" source = dhcp netsh interface ip set wins name = "Local Area Connection" source = dhcp netsh interface ip show config pause
|
|
|
|