Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Change from Static IP Address to DHCP
In a nutshell, you can use this utility to change from/to DHCP or set an IP address/subnet mask/gateway from the command line. If you needed to set WINS or DNS entries, you can still push them into the registry.
Example:
RunWait('Netsh.exe','interface ip set address "Local Area Connection" static %dev4ip% %subnet% %gw% 1')
You can use the netsh command in Windows 2000 to script the process of changing a computer from a static Internet Protocol (IP) address to Dynamic Host Configuration Protocol (DHCP) or vice versa. The netsh command accomplishes this task without the need to restart the computer. This feature is particularly useful for laptops that move from one environment to another, when it is necessary to use statically assigned IP addresses at one location and DHCP assigned IP addresses at another.
To switch the specified adapter from a static address to DHCP, type the following command:
netsh interface ip set address "Local Area Connection" dhcpNOTE: Typing this command changes the interface named "Local Area Connection" to DHCP.
netsh interface ip show ipaddressTo change to a static address, type the following command:
netsh interface ip set address "Local Area Connection" static ipaddr subnetmask gateway metricNOTE: Replace ipaddr with the static IP address, subnetmask with the subnet mask, gateway with the default gateway and, if necessary, metric with the appropriate metric. The following example changes the interface "Local Area Connection" to a static address of 192.168.0.10 with a subnet mask of 255.255.255.0, and the interface has a default gateway of 192.168.0.1 with a metric of 1:
netsh interface ip set address "Local Area Connection" static 192.168.0.10 255.255.255.0 192.168.0.1 1
Article ID: W14975
File Created: 2001:11:08:12:41:16
Last Updated: 2001:11:08:12:41:16