ipchange.bat

@echo off
cls
:start
echo.
echo 1. DHCP 사용
echo 2. 10.20.30.40 사용
echo 0. EXIT
echo.

set interfaceName=로컬 영역 연결
set choice=
set /p choice=

if not '%choice%' == '' set choice=%choice:~0,1%

if '%choice%' == '1' goto menuDHCP
if '%choice%' == '2' goto menuStatic

goto end

:menuDHCP
netsh interface ip set address name="%interfaceName%" source=dhcp
netsh interface ip set dns name="%interfaceName%" source=dhcp

goto check

:menuStatic
rem netsh interface ip delete dns "%interfaceName%" all
rem netsh interface ip delete wins "%interfaceName%" all

netsh interface ip set address name="%interfaceName%" source=static addr=10.20.30.40 mask=255.0.0.0 gateway=10.20.30.1 gwmetric=1
netsh interface ip set dns name="%interfaceName%" source=static addr=221.139.13.130

goto check

:check
ipconfig /all
pause
exit

:end