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

Can*_*ner 0 linux shell android batch-file

我需要能够在连接到我的PC的root电脑上运行以下命令:

su
mount -o rw,remount /system
chmod 777 /system/app/
exit
exit
Run Code Online (Sandbox Code Playgroud)

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

adb push ..\bin\MyApp_signed.apk /system/app/
Run Code Online (Sandbox Code Playgroud)

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

su
chmod 755 /system/app/
reboot
exit
exit
Run Code Online (Sandbox Code Playgroud)

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

Dar*_*tle 5

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
Run Code Online (Sandbox Code Playgroud)

如果您的su命令不支持命令,则可以将脚本留在捆绑设备端的设备上.