1

i am writing batch script for executing adb commands but while executing "SU" commands only the first commands runs "adb shell" and stops as the script is typing all the commands very fast and not waiting for previous command to run completely so that next command can be entered into the shell window that is "su" example of code is below

:lckscreen
 adb shell
 su
 rm /data/system/gesture.key
 rm /data/system/*.key
 exit
 exit
 pause
 goto menu4

i also tried

adb shell & su 

but still same Result

shell@Samsung_s4:/ $

please help

Prashant Mishra
  • 89
  • 1
  • 2
  • 14
  • i have also tried adb shell || su but no use – Prashant Mishra Oct 09 '16 at 20:58
  • Your script calls adb then waits for ADB to exit then attempts to run the rest of your commands, which makes no sense in a batch file. That's just how batch files work. –  Oct 09 '16 at 21:14

2 Answers2

1

Please try

adb shell "su -c 'rm /data/system/gesture.key'"
adb shell "su -c 'rm /data/system/*.key'"

and see the question in How to use su command over adb shell?

Community
  • 1
  • 1
-1

You will have to create a separate .txt file containing all the shell commands, in example:

su mount -o remount,rw /system mv /system/build.prop /sdcard

Make sure to have put an "enter" at the bottom to execute the last command. Now, in the bat file, where you'd normally put adb shell etc. Put adb shell > nameofyourtxt.txt.

If the only command you want to execute is "su", you can do adb shell su.

RAZERZ
  • 200
  • 1
  • 11