13

I try to make batch file to run adb commands. I want to use su -c, but I get the error:

 su: invalid uid/gid '-c'. 

I saw somewhere that my su version doesn't support -c, how can I enable this?

2 Answers 2

19

In batch file it should be like this:

adb shell "su 0 <command args>"

For example:

adb shell "su 0 mount -o rw,remount /system"
Sign up to request clarification or add additional context in comments.

1 Comment

0 is uid for root
2

The standard Android su is much simpler than its regular linux counterpart. It does not support any commands other than -c - so it's become redundant.

usage: su [UID[,GID[,GID2]...]] [COMMAND [ARG...]]

5 Comments

Somehow, as I said, my 'su' doesn't support even '-c'. (I use Android)
su -c 'command args' becomes su 0 command args in Android
ok. so if I want to run commands (using batch script) from a wanted and specific path in my devices, how can I do it without it?
@AlexP. do you know what 0 means here?
@AlirezaA.Ahmadi 0 is the user ID you want to run the command as, so 0 for root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.