Add & Remove IP in batch file

Add IP

@ECHO OFF

set varip=10.2.1.1
set varsm=255.255.255.0
set vargw=10.2.1.254

REM ***** You don’t need to change anything below this line! ******

netsh int ip add address name = "Local Area Connection" addr = %varip% mask = %varsm% gateway = %vargw% gwmetric = 1

ECHO Here are the new settings for %computername%:
netsh int ip show config

pause

Remove IP

@ECHO OFF

set varip=10.2.1.1


netsh int ip delete address name = "Local Area Connection" addr = %varip%
ECHO Here are the new settings for %computername%:
netsh int ip show config

pause




Comments