(编辑:jimmy 日期: 2024/12/23 浏览:2)
实现代码一: 通过 route print 实现
@echo off for /f "tokens=4" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do ( set IP=%%a ) echo %IP%
实现代码二:
@echo off for /f "tokens=15" %%i in ('ipconfig ^| find /i "ip address"') do (echo %%i) pause>nul