- @echo off & cd /d "%~dp0"
- setlocal enabledelayedexpansion
- set "num=0"
- for /f "tokens=2,3,4,5 delims=.: " %%i in ('ipconfig ^| findstr /i "默认网关"') do set /a "num=(%%i<<24)+(%%j<<16)+(%%k<<8)+%%l"
- set /a "num+=1"
- for /l %%i in (1,1,4) do (
- set /a "num1=num>>8<<8"
- set /a "num1=num-num1"
- set /a "num=num>>8"
- set "ip=!num1!.!ip!"
- )
- set "ip=!ip:~0,-1!"
- echo !ip!
- echo !ip!>"ip.ini"
- pause&exit
复制代码
|