I've started working on little something, not too much, but I keep getting stuck.
echo Look at your phone, you must grant superuser perms.
adb shell "su -c stop"
if NOT %errorlevel% == 0 goto exit
pause
So, if someone doesn't grant superuser access, it's not going to exit, it just continues, so if he grants it after the command times out, he has to restart the script. How do I write it so it repeats until the device is granted su permissions?
The following command will loop until su
succeeds:
:noroot
adb shell "su 0 id" | findstr "uid=0(root)" || goto noroot
As a side note, I was always puzzled by people trying to supply -c
as a parameter for android su
command. According to su
command source, the proper format is su [uid[,gid[,group1]...] [cmd]]