Tuesday, March 16, 2010

How to set IP Address, Subnet Mask, Default Gateway and DNS via command prompt batch file

:This is coded by JOHN IAN R. MEDILO
:dated March 17, 2010 05:35am
:Usage: set address[name][[source=]dhcp| static [addr=]IP address[mask=]IP subnet mask][[geteway=]|none [gwmetric=]integer]"
:netsh interface ip show config
cls
@echo Hello World, we will change you IP.
@echo
@echo Please wait....
@echo off

@echo Changing your IP Address, Subnet Mask and Default Gateway
netsh interface ip set address "Local Area Connection" static 192.168.1.2 255.255.255.0 192.168.1.1

@echo Deleting all DNS
netsh interface ip delete dns "Local Area Connection" all

@echo Adding primary DNS = 8.8.8.8 ; NOTE: open DNS
netsh interface ip set dns "Local Area Connection" static 8.8.8.8 primary

@echo Adding Secondary DNS = 8.8.4.4; NOTE: open DNS
netsh interface ip add dns "Local Area Connection" 8.8.4.4 index=2

@echo Adding Secondary DNS = 4.1.1.1; NOTE: open DNS
netsh interface ip add dns "Local Area Connection" 8.8.4.4 index=3

ipconfig /all
netsh interface ip show config