- @echo off
- title ip
- mode con cols=50 lines=10
- color 0a
- ver | find "5.1." > NUL && goto show51
- ver | find "6.1." > NUL && goto show61
- :show51
- @echo 当前系统是:[WindowsXP ]
- for /f "tokens=2 delims=:" %%i in ('ipconfig ^| find /i "ip address"') do set ip=%%i
- echo ==============================
- echo %ip%
- echo ==============================
- pause & exit
- :show61
- @echo 当前系统是:[Windows7 ]
- for /f "tokens=2 delims=:" %%i in ('ipconfig ^| find /i "ipv4 地址"') do set ip=%%i
- echo ==============================
- echo 您的ip地址为:%ip%
- echo ==============================
- pause & exit
复制代码 回显显示ip 要提取 可以改一改 |