【发布时间】:2017-02-04 14:22:35
【问题描述】:
我正在尝试编写一个批处理脚本来自动执行某些任务并根据上一个命令的响应或输出来生态化下一个命令或输出。
adb connect %IP%:5555
if errorlevel 1 (
echo Not Able To connect With Provided Ip Address
goto getip
) else (
echo Connected Over Wifi
goto menu2
)
但它不起作用,因为我认为在每种情况下错误级别都是 0 由于设备连接成功或未输出相同的“通过 wifi 连接”。
一般来说,当我们输入命令adb connect <IP> 时,输出是
1)连接成功输出是
connected to 192.168.10.13:5555
2)当android设备在wifi lan并且输入“ip”正确但“5555”端口未打开时输出是
unable to connect to 192.168.10.13:5555: cannot connect to 192.168.10.13:5555: No connection could be made because the target machine actively refused it. (10061)
3)笔记本电脑wifi关闭时
unable to connect to 192.168.10.13:5555: cannot connect to 192.168.10.13:5555: A socket operation was attempted to an unreachable host. (10065)
4) android 的 wifi 关闭时
unable to connect to 192.168.10.2:5555: cannot connect to 192.168.10.2:5555: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060)
我只想定义两种情况"connection Successful" or "Not Successful"
我应该怎么做才能根据 adb over wifi 连接设置自动执行任务。请帮忙
【问题讨论】:
标签: batch-file adb