Batch command: script to modify the IP address and DNS

Modify the IP address and DNS script:

OFF @echo
 echo .
 echo --------- alternative IP address ------------
 echo  1 , IP address 1!
 echo  2 , IP address 2!
 echo .
:again
SET / P = INPUT enter the IP address type to be set:
 IF  " %% INPUT " == " . 1 " (
netsh interface ip set address Wi-Fi static 192.168 . 1.155  255.255 . 255.0  192.168 . 1.1  . 1 > NUL
netsh interface ip set dns Wi-Fi static 192.168 . 1.1 > NUL
 echo .
 echo has been set to the IP address of a network card!
goto end
)
if "%input%"=="2" (
netsh interface ip set address Wi-Fi static 192.168 . 2.154  255.255 . 255.0  192.168 . 2.1  . 1 > NUL
netsh interface ip set dns Wi-Fi static 192.168 . 2.1 > NUL
 echo .
 echo has card is set to address 2!
goto end
)
echo Please type the correct input selection:
 echo  1 !, IP address 1
 echo  2 , IP address 2!
pause
goto again
:end

 

Guess you like

Origin www.cnblogs.com/miaosj/p/12100409.html