- @echo off
- ipconfig /all>"%temp%\ipList.txt"
- for /f "tokens=1 delims=:" %%a in ('findstr /n "宽带连接:" "%temp%\ipList.txt"') do (
- set SkipRow=%%a
- goto :MySkip
- )
-
- :MySkip
- for /f "usebackq skip=%SkipRow% tokens=1,16" %%a in ("%temp%\ipList.txt") do (
- if "%%a" equ "IPv4" (
- set IP=%%b
- goto :ShowResult
- )
- )
-
- :ShowResult
- echo,%IP%
- pause
复制代码
|