bat脚本显示本机IP地址的两种方法(内网ip)

实现代码一: 通过 route prin...

实现代码一: 通过 route print 实现

@echo offfor /f "tokens=4" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do ( set IP=%%a)echo %IP%

实现代码二:

@echo offfor /f "tokens=15" %%i in ('ipconfig ^| find /i "ip address"') do (echo %%i)pause>nul

Related Posts

Comments are closed.