0
我想寫一個批處理腳本來自動執行一些任務,並根據前一個命令的響應或輸出來生成下一個命令或輸出。批處理腳本adb通過wifi連接
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」裝置。
Generaly當我們進入命令adb connect <IP>
輸出是
1)連接成功輸出是
connected to 192.168.10.13:5555
2)當機器人設備在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的無線網絡連接關閉
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"
我應該怎麼辦根據亞行通過WiFi連接設置自動完成的任務。請幫助
感謝的對你有所幫助您的代碼工作 –
@soja是否有可能管道輸出一次,一次又一次地使用它的搜索令牌來決定什麼是那麼實際的錯誤顯示的錯誤 –
我不知道是什麼你意思是。 – soja