从 python 输入 adb shell

Enter adb shell from python

我正在尝试从 python 向 adb shell 执行命令 我正在使用 Windows OS

在 CMD 上:

C:\Users\deounix>adb shell
shell@android:/ $ su root
su root
root@android:/ # reboot

我正在做的是:

import os

os.popen("adb shell & su root & reboot")

但是没用

我该怎么做?

import os
os.system("adb shell su -c reboot")
import os
os.system("c:/platform-tools/adb devices")

对运行任何命令如adb devices on python执行上面的命令 这肯定会奏效。您只需要确认您获得 adb 的路径 shell