日期:2014-05-17 浏览次数:20810 次
用 “ipconfig“ 可以看到自己的 IP地址 后面加个 "/all " 就可以看到详细信息 比如说网关,网卡,DNS,等信息 arp -a : 查看与你能够通信的局域网主机IP地址 net view 可以看到局域网内的所有的机器
------解决方案--------------------
test.bat
@echo off set IPPart1=192 set IPPart2=168 set IPPart3=10 set IPPart4=# goto :next for /l %%a in (2,1,254) do ( ping -n 1 -l %IPPart1%.%IPPart2%.%IPPart1%.%%a >nul ) rem Don't care whether an IP is pingable. We just need the arp cache. :next arp -a>"%temp%\UsedIP.tmp" for /l %%a in (254,-1,2) do ( findstr "%IPPart1%\.%IPPart2%\.%IPPart1%\.%%a" "%temp%\UsedIP.tmp"||set IPPart4=%%a goto :FindIP ) :FindIP if "%IPPart4%" neq "#" ( echo Find an available IP: %IPPart1%.%IPPart2%.%IPPart1%.%IPPart4% ) else ( echo No IP is available currently. ) pause goto :eof