批处理获取本机IP地址
2019-9-17 乱云飞 评论(1) 浏览(698) 标签: 批处理 获取IP 获取IP地址 本机IP
@echo off @for /f "tokens=4" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do (@set IP=%%a)>NUL 2>NUL @echo 本机IP地址是:%IP%
----------------------------
@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是:%IP%
@pause>nul
@cmd/k
----------------------------
@echo off
for /f "tokens=2 delims=:" %%a in ('ipconfig ^| findstr /c:"IPv4"') do (set "ipAddress=%%a")
echo 本机IP地址是:%ipAddress%
cmd/k