gpt4 book ai didi

android - 使用批处理文件在 linux shell 中运行命令

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:53:35 29 4
gpt4 key购买 nike

我需要能够在连接到我的 PC 的已获得 root 权限的 Android 手机上运行以下命令:

su
mount -o rw,remount /system
chmod 777 /system/app/
exit
exit

然后我需要在我的电脑上执行以下命令:

adb push ..\bin\MyApp_signed.apk /system/app/

最后,我需要做一些清理并重启手机:

su
chmod 755 /system/app/
reboot
exit
exit

如何创建 Windows 批处理文件,以便将这些 shell 命令传递给 android shell?

最佳答案

adb shell <command>允许您从您的计算机在设备上运行 shell 命令。如果你的su命令支持 -c选项,你可以这样做:

adb shell su -c "mount -o rw,remount /system"
adb shell su -c "chmod 777 /system/app/"

adb push ..\bin\MyApp_signed.apk /system/app/

adb shell su -c "chmod 755 /system/app/"
adb shell su -c reboot

如果您的 su command 不支持命令,您可以制作一个脚本保留在 bundle 设备端的设备上。

关于android - 使用批处理文件在 linux shell 中运行命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11011667/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com