背景
使用 adb 连接多设备后,只保留其中一个设备,其他设备在 adb devices 的 list 中均为 offline 状态,此时想对设备进行操作会需要选择某个设备,任何 adb 命令都需要选择。这时就需要删除多余的 offline 设备
问题
怎样删除多余的 offline 设备
解决方法
https://blog.csdn.net/chichoxian/article/details/96426418
https://blog.csdn.net/Jason_yesly/article/details/103997806
https://www.125la.com/2970.html
其中 win 系统下, 查找字符串应该使用 | findstr xxx
本人经过测试后最简单也是最直接的解决方法:关闭 adb后 重启一个adb
- adb devices
- tasklist | findstr adb
output:adb.exe 3940 Console 1 19,324 K
- taskkill /F /PID 3940 // -F:指定强制终止进程。 /PID: 指定要终止的进程的 PID. 使用 TaskList 取得 PID。
output:成功: 已终止 PID 为 3940 的进程。
- adb devices
至此,adb 会在另外一个进程中重启, adb devices 是没有 offline 设备的.可以通过 tasklist | findstr adb 查看新的进程ID