Wednesday, December 24, 2014

Change IP Address Using A Batch File Script

                                       Netsh is a command-line scripting utility that allows you to, either locally or remotely, display or modify the network configuration of a computer that is currently running. Netsh also provides a scripting feature that allows you to run a group of commands in batch mode against a specified computer.
Set Static IP :-
cd\
cls
ipconfig/flushdns
ipconfig/release
netsh int ipv4 set address name="Local Area Connection" source=static address=192.168.172.17 mask=255.255.254.0 gateway=192.168.173.254
netsh int ipv4 set dns name="Local Area Connection" source=static address=192.168.0.5 register=primary validate=no
pause
Set Dynamic IP :-
@echo off
ipconfig /flushdns
ipconfig /release
netsh interface set interface "Local Area Connection" disable
netsh interface ip set dns "Local Area Connection" dhcp
netsh interface ip set address "Local Area Connection" dhcp
echo Wait 5 seconds...
ping -n 60 -w 1000 0.0.0.1 > nul
netsh interface set interface "Local Area Connection" enable

No comments:

Post a Comment

bloggerwidgets