Save the following content as IP.BAT or IP.CMD
@echo off
rem Change the IP address and gateway to commonly used values
set IP=192.168.3.148
set mask=255.255.255.0
set gateway=192.168.3.254
set DNS1=202.96.64.68
set DNS2=202.96.75.68
set Interface=Local Area Connection
cls
echo.
echo The current network connection properties are as follows:
ipconfig /all
echo.
pause
rem ============== Manual selection setup starts ==============
:MANUAL
cls
echo.
echo.
echo Please select the number of the network connection, press Enter to default to "1. Local Area Connection"
echo.
echo 1. Local Area Connection
echo 2. Local Area Connection 2
echo 3. Local Area Connection 3
echo 4. Local Area Connection 4
echo 5. Local Area Connection 5
echo.
set KEY=1
set /p KEY=Interface:
if %KEY% == 1 set Interface=Local Area Connection
if %KEY% == 2 set Interface=Local Area Connection 2
if %KEY% == 3 set Interface=Local Area Connection 3
if %KEY% == 4 set Interface=Local Area Connection 4
if %KEY% == 5 set Interface=Local Area Connection 5
echo.
echo The default IP address is %IP%, please enter the new IP address and press Enter to set it to the default value
echo.
set /p IP=IP:
echo.
echo The default subnet mask address is %mask%, please enter the new Mask and press Enter to set it to the default value
echo.
set /p mask=Mask:
echo.
echo The default gateway address is %gateway%, please enter the new Gateway and press Enter to set it to the default value
echo.
set /p gateway=Gateway:
ECHO.
echo The default primary DNS address is %DNS1%, please enter the new primary DNS and press Enter to set it to the default value
echo.
set /p DNS1=DNS1:
echo.
echo The default secondary DNS address is %DNS2%, please enter the new secondary DNS and press Enter to set it to the default value
echo.
set /p DNS2=DNS2:
cls
echo.
echo You have set the following for "%Interface%":
echo.
ECHO IP address: %IP%
ECHO Mask: %mask%
ECHO Gateway address: %gateway%
ECHO Primary DNS address: %DNS1%
ECHO Secondary DNS address: %DNS2%
echo.
echo.
set KEY=EXIT
echo Press "1" to enable the above settings, press "2" to reset, press any key to exit
echo.
set /p KEY=Choice:
if %KEY% == 1 goto DO
if %KEY% == 2 goto MANUAL
GOTO END
rem ============== Manual selection setup ends ==============
:DO
echo.
echo Changing IP...
echo.
netsh interface ip set address name="%Interface%" source=static addr=%IP% mask=%mask%
echo IP address and subnet mask set successfully!
echo.
netsh interface ip set address name="%Interface%" gateway=%gateway% gwmetric=1
echo Gateway address set successfully!
echo.
netsh interface ip set dns name="%Interface%" source=static addr=%DNS1%
echo Primary DNS address set successfully!
echo.
netsh interface ip add dns name="%Interface%" addr=%DNS2% index=2
echo Secondary DNS address set successfully!
:END
pause && exit
[ Last edited by zhqw on 2007-11-6 at 11:28 AM ]
@echo off
rem Change the IP address and gateway to commonly used values
set IP=192.168.3.148
set mask=255.255.255.0
set gateway=192.168.3.254
set DNS1=202.96.64.68
set DNS2=202.96.75.68
set Interface=Local Area Connection
cls
echo.
echo The current network connection properties are as follows:
ipconfig /all
echo.
pause
rem ============== Manual selection setup starts ==============
:MANUAL
cls
echo.
echo.
echo Please select the number of the network connection, press Enter to default to "1. Local Area Connection"
echo.
echo 1. Local Area Connection
echo 2. Local Area Connection 2
echo 3. Local Area Connection 3
echo 4. Local Area Connection 4
echo 5. Local Area Connection 5
echo.
set KEY=1
set /p KEY=Interface:
if %KEY% == 1 set Interface=Local Area Connection
if %KEY% == 2 set Interface=Local Area Connection 2
if %KEY% == 3 set Interface=Local Area Connection 3
if %KEY% == 4 set Interface=Local Area Connection 4
if %KEY% == 5 set Interface=Local Area Connection 5
echo.
echo The default IP address is %IP%, please enter the new IP address and press Enter to set it to the default value
echo.
set /p IP=IP:
echo.
echo The default subnet mask address is %mask%, please enter the new Mask and press Enter to set it to the default value
echo.
set /p mask=Mask:
echo.
echo The default gateway address is %gateway%, please enter the new Gateway and press Enter to set it to the default value
echo.
set /p gateway=Gateway:
ECHO.
echo The default primary DNS address is %DNS1%, please enter the new primary DNS and press Enter to set it to the default value
echo.
set /p DNS1=DNS1:
echo.
echo The default secondary DNS address is %DNS2%, please enter the new secondary DNS and press Enter to set it to the default value
echo.
set /p DNS2=DNS2:
cls
echo.
echo You have set the following for "%Interface%":
echo.
ECHO IP address: %IP%
ECHO Mask: %mask%
ECHO Gateway address: %gateway%
ECHO Primary DNS address: %DNS1%
ECHO Secondary DNS address: %DNS2%
echo.
echo.
set KEY=EXIT
echo Press "1" to enable the above settings, press "2" to reset, press any key to exit
echo.
set /p KEY=Choice:
if %KEY% == 1 goto DO
if %KEY% == 2 goto MANUAL
GOTO END
rem ============== Manual selection setup ends ==============
:DO
echo.
echo Changing IP...
echo.
netsh interface ip set address name="%Interface%" source=static addr=%IP% mask=%mask%
echo IP address and subnet mask set successfully!
echo.
netsh interface ip set address name="%Interface%" gateway=%gateway% gwmetric=1
echo Gateway address set successfully!
echo.
netsh interface ip set dns name="%Interface%" source=static addr=%DNS1%
echo Primary DNS address set successfully!
echo.
netsh interface ip add dns name="%Interface%" addr=%DNS2% index=2
echo Secondary DNS address set successfully!
:END
pause && exit
[ Last edited by zhqw on 2007-11-6 at 11:28 AM ]
