Is it possible to make the following commands a one-liner command ? to change bootanimation.zip quickly and gain some

C:\Users\User\Desktop>adb push bootanimation /sdcard
C:\Users\User\Desktop>adb shell
$ su
# mount -o rw,remount /system
# cp /sdcard/bootanimation.zip /system/media/bootanimation.zip
# chmod 644 /system/media/bootanimation.zip
# reboot


  • 3
    Why not put your desired commands inside a shell script and simply invoke that? – CzarMatt Jun 18 '19 at 17:02
  • To whom it may concern! Consider adding a comment when down-voting! – M. Abdelhafid Jun 19 '19 at 15:13

Much like @CzarMatt I'd suggest saving the commands ya want run within the Android device to a shell script such as adb_boot_animation_copy.sh on your PC...

#!/usr/bin/env sh

if ! [ -f "/sdcard/bootanimation.zip" ]; then
    printf 'No can do\n' >&2
    exit 1

su || exit "$?"
mount -o rw,remount /system

cp /sdcard/bootanimation.zip /system/media/bootanimation.zip
chmod 644 /system/media/bootanimation.zip

Tip, #!/usr/bin/env sh is more portable than #!/bin/sh... this is not just because the Android dev. team thought it was a good idea to move things about when adopting Linux into Android, there are other unixish OSs that also got clever with where one can find an executable shell.

... then use redirection with either < or cat...

adb shell "$(cat "adb_boot_animation_copy.sh")"

Which essentially does the typing of the commands saved within the adb_boot_animation_copy.sh file for ya. Though I'm not certain that this kind of redirection will work on MS bound devices without some modifications.


Another way to redirect output of one command into the input of another...

cat adb_boot_animation_copy.sh | adb shell

Note PowerShell does have the cat command, though ya might want to edit the file path from the above examples to be an absolute file path.

... which should result in the same behavior of redirecting commands from the adb_boot_animation_copy.sh file into the adb shell.

And yet another way would be to use the FOR \? syntax within a batch script...

FOR /F "tokens=* USEBACKQ" %%F IN (`type adb_boot_animation_copy.sh`) DO (
    SET var=%%F

... to save the continence of a file to a variable for later redirection into adb, eg something like adb shell "%var%", or use type in place of cat and >/< instead of |...

type adb_boot_animation_copy.sh > adb shell

If ya run into issues leave a comment and perhaps I'll make another edit with more ways of doing the same thing.

| improve this answer | |
  • 1
    He used windows os. – M. Rostami Jun 19 '19 at 5:20
  • 1
    @M.Rostami considering that PowerShell also has the cat command I don't think ya can blame me for the OP's reliance on MS products, nor should this answer be down voted as it is correct for Unix'ish devices and only requires a small amount of adjustment to likely get something that operates similarly on MS devices. – S0AndS0 Jun 19 '19 at 15:00

Finally I figured out how to do it in a one-liner adb command from Windows CMD Shell:

adb push bootanimation.zip /sdcard & adb shell "su -c 'mount -o rw,remount /system & rm /system/media/bootanimation.zip & cp /sdcard/bootanimation.zip /system/media & chmod 644 /system/media/bootanimation.zip & reboot'"

In order to make this one line useful in a batch file use && instead of &

adb push bootanimation.zip /sdcard && adb shell "su -c 'mount -o rw,remount /system && rm /system/media/bootanimation.zip && cp /sdcard/bootanimation.zip /system/media && chmod 644 /system/media/bootanimation.zip && reboot'"

Thank you for your time & contributions!

| improve this answer | |
  • 2
    In short that's gross. And I think this should have been added to your answer as an edit so that readers can help ya in writing something saner, because what you've got there at the moment is not easily maintained, documented, debugged, or extended/edited. – S0AndS0 Jun 19 '19 at 15:31
  • I assume that you're one of the down-voters, but sorry your reply is out of the scope of the question and it's linux specific! cheers! – M. Abdelhafid Jun 19 '19 at 19:25
  • 1
    That would be your assumption... As for my reply/answer, if ya re-check it you'll find that there's been some MS related additions for how to do similar with non-Unix like Operating Systems, while also allowing for future debugging and/or expansion of features. Additionally if ya dig deeper into Android you'll find that it's based on the Linux Kernel and has many of the same utilities when at the shell level... though with some rather annoying differences of behavior, options, and file paths. Best of luck avoiding disaster with your endeavors. – S0AndS0 Jun 19 '19 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.