netstat -ano|findstr 127.0.0.1:
for /l %%i in (1000,1,9999) do (
set n=%%i
echo adb connect 127.0.0.1:%%i
::adb connect 127.0.0.1:%%i2>nul
adb connect 127.0.0.1:%%i
echo 执行结果:%errorlevel%
)
pause
从端口1000开始连接到9999
C:\Users\Administrator\Desktop>netstat -anob -p tcp|findstr 127.0.0.1:
TCP 127.0.0.1:1028 127.0.0.1:1030 ESTABLISHED 1376
TCP 127.0.0.1:1029 127.0.0.1:1031 ESTABLISHED 1376
TCP 127.0.0.1:1030 127.0.0.1:1028 ESTABLISHED 1376
TCP 127.0.0.1:1031 127.0.0.1:1029 ESTABLISHED 1376
TCP 127.0.0.1:1226 127.0.0.1:1227 ESTABLISHED 6632
TCP 127.0.0.1:1227 127.0.0.1:1226 ESTABLISHED 6632
TCP 127.0.0.1:1228 127.0.0.1:1229 ESTABLISHED 6632
TCP 127.0.0.1:1229 127.0.0.1:1228 ESTABLISHED 6632
TCP 127.0.0.1:1498 127.0.0.1:1499 ESTABLISHED 8780
TCP 127.0.0.1:1499 127.0.0.1:1498 ESTABLISHED 8780
TCP 127.0.0.1:1700 127.0.0.1:1701 ESTABLISHED 6632
TCP 127.0.0.1:1701 127.0.0.1:1700 ESTABLISHED 6632
TCP 127.0.0.1:1965 127.0.0.1:1966 ESTABLISHED 6632
TCP 127.0.0.1:1966 127.0.0.1:1965 ESTABLISHED 6632
TCP 127.0.0.1:4300 0.0.0.0:0 LISTENING 4848
TCP 127.0.0.1:4301 0.0.0.0:0 LISTENING 4848
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 13168
TCP 127.0.0.1:5037 127.0.0.1:9221 ESTABLISHED 13168
TCP 127.0.0.1:5037 127.0.0.1:10546 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10547 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10552 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10553 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10557 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10558 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10563 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10564 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10568 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10569 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10573 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10574 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10578 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10579 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10583 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10584 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10589 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10590 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10594 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10595 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:10599 TIME_WAIT 0
TCP 127.0.0.1:6331 127.0.0.1:9970 ESTABLISHED 9812
TCP 127.0.0.1:6332 127.0.0.1:9975 ESTABLISHED 9812
TCP 127.0.0.1:6333 127.0.0.1:9971 ESTABLISHED 9812
TCP 127.0.0.1:6942 0.0.0.0:0 LISTENING 6632
TCP 127.0.0.1:8700 0.0.0.0:0 LISTENING 6632
TCP 127.0.0.1:8890 0.0.0.0:0 LISTENING 1376
TCP 127.0.0.1:8990 0.0.0.0:0 LISTENING 1376
TCP 127.0.0.1:9221 127.0.0.1:5037 ESTABLISHED 6632
TCP 127.0.0.1:9222 127.0.0.1:9223 ESTABLISHED 13168
TCP 127.0.0.1:9223 127.0.0.1:9222 ESTABLISHED 13168
TCP 127.0.0.1:9226 127.0.0.1:9227 ESTABLISHED 13168
TCP 127.0.0.1:9227 127.0.0.1:9226 ESTABLISHED 13168
TCP 127.0.0.1:9970 0.0.0.0:0 LISTENING 12416
TCP 127.0.0.1:9970 127.0.0.1:6331 ESTABLISHED 12416
TCP 127.0.0.1:9971 0.0.0.0:0 LISTENING 12416
TCP 127.0.0.1:9971 127.0.0.1:6333 ESTABLISHED 12416
TCP 127.0.0.1:9975 0.0.0.0:0 LISTENING 12416
TCP 127.0.0.1:9975 127.0.0.1:6332 ESTABLISHED 12416
TCP 127.0.0.1:9976 0.0.0.0:0 LISTENING 12416
TCP 127.0.0.1:10548 127.0.0.1:10549 TIME_WAIT 0
TCP 127.0.0.1:10554 127.0.0.1:10555 TIME_WAIT 0
TCP 127.0.0.1:10559 127.0.0.1:10560 TIME_WAIT 0
TCP 127.0.0.1:10565 127.0.0.1:10566 TIME_WAIT 0
TCP 127.0.0.1:10570 127.0.0.1:10571 TIME_WAIT 0
TCP 127.0.0.1:10575 127.0.0.1:10576 TIME_WAIT 0
TCP 127.0.0.1:10580 127.0.0.1:10581 TIME_WAIT 0
TCP 127.0.0.1:10585 127.0.0.1:10586 TIME_WAIT 0
TCP 127.0.0.1:10591 127.0.0.1:10592 TIME_WAIT 0
TCP 127.0.0.1:10596 127.0.0.1:10597 TIME_WAIT 0
TCP 127.0.0.1:12101 0.0.0.0:0 LISTENING 4848
TCP 127.0.0.1:63342 0.0.0.0:0 LISTENING 6632
经过研究发现,这个模拟器没得端口。