Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7550459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:13:06+00:00 2026-05-30T10:13:06+00:00

I have created a script to mount partitions and do some stuff in my

  • 0

I have created a script to mount partitions and do some stuff in my Android system. I saved the script as install.sh in the /bin folder of Android.

I want to call the script from ADB, which is itself called from a batch file on Windows, but it needs to be executed as root.

The first solution I tried was to call the script using

adb shell "su -c sh /bin/script.sh"

but it does not work as it gives me a shell access (with root permissions), but nothing is executed.
I also tried to call

adb root "sh /bin/script.sh"

but I got the following error

adbd cannot run as root in production builds

I then tried to write

su -c "command"

for all the commands which need a root access in my script, but I have the same problem.
When I run the script I only obtain a root shell and nothing is executed.

If I use the first solution by hand (e.g. I call adb shell su, then my script), it works. However the whole point is to automate the process, so that adb shell can be called from another script.

Do you have any idea of how I could achieve this ?

Thanks !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:13:08+00:00Added an answer on May 30, 2026 at 10:13 am

    This works for me:

    Create myscript.bat and put into it (note the single quotes around the commands to be executed in superuser mode):

    adb shell "su -c 'command1; command2; command3'"
    

    then run myscript.bat from a DOS shell.

    Note: it doesn’t appear that the the DOS line continuation character (^) works in this situation. In other words, the following doesn’t work for me:

    adb shell "su -c '^
    command1; ^
    command2; ^
    command3'"
    

    This results in “Syntax error: Unterminated quoted string”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a script that saves some files in the Documents directory of
I have created a simple JQuery script with hovering effect on some links. The
I have created a script in python and saved it as .pyw file so
I have created a pipe script in CPanel and have placed the hashbang: #!/usr/bin/php
I have created a script with AppleScript to extract email body according to some
I have created simple script: #!/bin/sh column=${1:-1} awk '{colawk='$column'+1; print colawk}' But when I
So I have created the following script: class spImageUpload() { private static System.Collections.Generic.List<string> keywords;
I have created a folder and 770 it; when I try to mount a
I have created custom attributes for a category in my module's install script like
I have created script to find selectivity of each columns for every tables. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.