Welcome to my site. Please CLICK HERE to give your opinions regarding this new look of "PCTipsbyAnu". Thanks for visiting.

Monday, July 5, 2010

Browse » Home » , , , , , , , » Change IP via batch in Win7 -3

Change IP via batch in Win7 -3


One thing I found in Windows 7 (and I assume it's the same in Vista and XP) - 
if you have the IPv6 stack installed, you need an additional parameter to specify whether you're changing IPv4 or IPv6 settings - 
simply insert ipv4 in between int and set and it'll work there, too. 




See the batch file I created for myself:

@echo off
if "%1"=="static" goto static
if "%1"=="dhcp" goto dhcp
echo Usage: %0 (static^|dhcp)
goto end2
:static
echo Setting static IP of 192.168.xxx.xxx
netsh int ipv4 set address "Local Area Connection" static 192.168.xxx.xxx 255.255.255.0 192.168.xxx.xxx 1
echo Setting primary DNS server to 192.168.xxx.xxx
netsh int ipv4 set dnsservers "Local Area Connection" static 192.168.xxx.xxx primary
goto end
:dhcp
echo Setting Dynamic (DHCP) IP
netsh int ipv4 set address "Local Area Connection" dhcp
echo Setting Dynamic (DHCP) DNS
netsh int ipv4 set dnsservers "Local Area Connection" dhcp
goto end
:end
echo Waiting for IP config to update...
@choice /c 12 /T 3 /d 1 >  NUL
ipconfig /all
pause
:end2

Also read my previous post on Change IP via BATCH, Change IP via BATCH -2
You can leave a response, or trackback from your own site.

About 'Anu': My name is 'Anu' also Known as 'ANU 007 TIGER' .I'm administrator of 'PC Tips by Anu' blog .This blog was opened for sharing contents about hacking n cracking.
Thanks YAHOO OR GMAIL

0 comments:

Post a Comment

 
Back to Top