Saturday, May 9, 2009

Change IP using batch file

For all those batch file lovers, MiXOMANiA team brings yet another comprehensive material for our visitors.......Most of the time we have to change our IP back and forth, so we do that manually.... Lets do that automatically using batch file.....
Here is the code


@echo off
:again
set /p choice=Please enter 1[HOME], 2[OFFICE] or END ??
if /i [%choice%]==[END] endlocal&goto end
if [%choice%]==[] goto again
if [%choice%]==[1] goto 1
if [%choice%]==[2] goto 2
set /p xxx=wrong entry, press any key to exit.
endlocal
goto end

:1
echo HOME setting configured.....
netsh interface ip set address name="Local Area Connection" source=static addr=222.111.108.101 mask=255.255.255.0
netsh interface ip set address name="Local Area Connection" gateway=222.111.108.1 gwmetric=0
netsh interface ip set dns name="Local Area Connection" source=static addr=222.111.107.8 register=primary
netsh interface ip add dns "Local Area Connection" 222.111.107.9 index=2
echo Ending IP Configuration
goto end

:2

echo OFFICE setting configured.....
netsh interface ip set address name="Local Area Connection" source=static addr=192.168.1.254 mask=255.255.255.0
netsh interface ip set address name="Local Area Connection" gateway=192.168.1.1 gwmetric=0
netsh interface ip set dns name="Local Area Connection" source=static addr=192.168.1.1 register=primary
netsh interface ip add dns "Local Area Connection" 192.168.1.2 index=2
echo Ending IP Configuration
goto end

:end
@echo on

Save the above code and use the extension ".bat" like "ip.bat", for your convenience we provided the batch file, you can download also.....
We hope that will be informative for you...


Download

Related Posts by Categories



0 comments: