Your problem is delayed expansion. All variable reads inside a block of code (code inside parenthesis) are replaced with the value in the variable before the block starts to execute. If a variable is changed inside the block, that new value can not be retrieved, as all reads to variables were replaced with values. To solve, enable delayed expansion and, in variables where delayed read is needed, change %var% sintax with !var! to indicate the parser to delay the read until the time of execution.
@echo off
set /p option=(1) Edit IP (2) Enable DHCP:
if %option%==1 (
set /p IP=New IP-Address:
set /p MASK=New Network Mask:
set /p GATE=New Gateway Address:
setlocal enabledelayedexpansion
netsh interface ip set address name="LAN" static !IP! !MASK! !GATE! 1
endlocal
)
if %option%==2 (
netsh interface ip set address name="LAN" source=dhcp
)
pause