ADB Shell Commands [Question] [Windows] [CMD] - Android Q&A, Help & Troubleshooting

My problem :
I got some adb (shell) commands which I have to send to my device (as once we open she'll it doesn't execute further lines in batch file , we have to input it manually in the window ) . I've been doing it by myself copying and pasting each line one by one but wish to automate it ,is there a way to create a batch file or some script to send them one after the other as the commands are being executed ?
•Here is my issue in short if you don't want to read the paragraph above:
Is there a way I can send commands (one after the other) to another cmd window via a batch file or something similar
Thanks !
(If there is some other thread/subforum where this question is more appropriate , please let me know , I'll post it there)

_V3D4N7_ said:
My problem :
I got some adb (shell) commands which I have to send to my device (as once we open she'll it doesn't execute further lines in batch file , we have to input it manually in the window ) . I've been doing it by myself copying and pasting each line one by one but wish to automate it ,is there a way to create a batch file or some script to send them one after the other as the commands are being executed ?
•Here is my issue in short if you don't want to read the paragraph above:
Is there a way I can send commands (one after the other) to another cmd window via a batch file or something similar
Thanks !
(If there is some other thread/subforum where this question is more appropriate , please let me know , I'll post it there)
Click to expand...
Click to collapse
Copy and paste???
Sent from my LEX820 using Tapatalk

bilausdaniel said:
Copy and paste???
Click to expand...
Click to collapse
Here is and example to elaborate my issue
It's like 1 line to get su rights ( in terminal )
Second line push/pull some files to device (I'm doing it via adb so have to leave the shell and work in another cmd window for that)
Then again go to shell to give further commands.
So I have to jump from shell to cmd and back to shell a lot of times .... So it's like run a command in shell and next in cmd so I can't copy like a whole paragraph and just paste it... that's the main issue I've been copying and pasting it's a quite repetitive task so wished to know if a script could do that for me.

_V3D4N7_ said:
Here is and example to elaborate my issue
It's like 1 line to get su rights ( in terminal )
Second line push/pull some files to device (I'm doing it via adb so have to leave the shell and work in another cmd window for that)
Then again go to shell to give further commands.
So I have to jump from shell to cmd and back to shell a lot of times .... So it's like run a command in shell and next in cmd so I can't copy like a whole paragraph and just paste it... that's the main issue I've been copying and pasting it's a quite repetitive task so wished to know if a script could do that for me.
Click to expand...
Click to collapse
Don't know such script,but you can use only windows.powershell as admin.doesnt.works this way?
Sent from my LEX820 using Tapatalk
---------- Post added at 12:00 PM ---------- Previous post was at 11:58 AM ----------
bilausdaniel said:
Don't know such script,but you can use only windows.powershell as admin.doesnt.works this way?
Sent from my LEX820 using Tapatalk
Click to expand...
Click to collapse
Anyway what exactly is this for? Want to connect phone to windows ? Do it by adb.use developer settings and a USB cable for transferring files in phone.
Sent from my LEX820 using Tapatalk

Related

For Noobs: Titanium Backup with Temp Root on Evo 3D

***Note: this is a "for noobs by noobs" post: meant to guide people step-by step. The only needed info I don't cover is BASIC dos commands like "cd" (the only one you really need for this). I didn't post this in development b/c I've added basically nothing except more thorough instructions for noobs like me. Hope this helps!!!***
If Temp Root was worth messing with at all, IMO it was worth messing with in order to do a titanium backup. That's what I was able to successfully with the method below.
I haven't seen this thread's equal here in the 3D forums, so I figured I would repost. All credit where credit is due! Teamwin and then Joel.bourquard for this write-up/slight modification to teamwin's solution.
SO: basically follow the write-up below exactly. I downloaded Titanium Backup and Superuser directly from the market before beginning. Also, after you've finished his steps you can simply click to open Titanium Backup (no need to fool with Superuser) and it'll recognize root, find all your programs(including system data/programs), etc etc. Works like a charm!
NOTE for NOOBS: Download the attached zip --I've included the needed ADB files as well. Attach your EVO 3D using a USB cord and make sure USB debugging is turned ON (check in Settings-->Applications-->Development) and also make sure you aren't letting your PC access your SD card (go to Settings-->Connect to PC and change default to "Charge Only")
Once you've downloaded and unzipped them, open a command prompt (start menu, type "cmd" and type enter). Once in the command prompt, navigate to wherever you downloaded/extracted the zip. FROM THERE, type in each command in the writeup below EXACTLY AS WRITTEN (with quotation marks and everything). Once you've done the last ste (adb shell "/data/bin/root.sh") you can grab your device and open Titanium Backup and VOILA!
----
THE WRITE-UP
Type these commands AS WRITTEN into your cmd prompt after you've (1) downloaded superuser and Titanium Backup from the market (2) downloaded and extracted the zip and (3) navigated your command prompt to the location where you extracted those files.
adb push fre3vo /data/local/tmp/
adb shell "cd /data/local/tmp ; chmod 755 fre3vo ; ./fre3vo"
adb shell "mkdir /data/bin ; mv /data/local/tmp/fre3vo /data/bin/"
adb push su /data/bin/
adb push root.sh /data/bin/
adb shell "chmod 4555 /data/bin/su ; chmod 755 /data/bin/root.sh"
adb shell "/data/bin/root.sh"
BINGO! Now open Titanium Backup and you're good to go!
For more info, PLEASE see the sources!
http://forum.xda-developers.com/showthread.php?t=1151735
http://therootofallevo.com/forums/viewtopic.php?f=8&t=76
sweet havent gotten it to work for me but ill keep on trying haha guess im a hardcore noob
No worries, me too! As long as you can change directories is dos you should be fine
Sent from my PG86100 using XDA App
panamaniac said:
***Note: this is a "for noobs by noobs" post: meant to guide people step-by step. The only needed info I don't cover is BASIC dos commands like "cd" (the only one you really need for this). I didn't post this in development b/c I've added basically nothing except more thorough instructions for noobs like me. Hope this helps!!!***
If Temp Root was worth messing with at all, IMO it was worth messing with in order to do a titanium backup. That's what I was able to successfully with the method below.
I haven't seen this thread's equal here in the 3D forums, so I figured I would repost. All credit where credit is due! Teamwin and then Joel.bourquard for this write-up/slight modification to teamwin's solution.
SO: basically follow the write-up below exactly. I downloaded Titanium Backup and Superuser directly from the market before beginning. Also, after you've finished his steps you can simply click to open Titanium Backup (no need to fool with Superuser) and it'll recognize root, find all your programs(including system data/programs), etc etc. Works like a charm!
NOTE for NOOBS: Download the attached zip --I've included the needed ADB files as well. Attach your EVO 3D using a USB cord and make sure USB debugging is turned ON (check in Settings-->Applications-->Development) and also make sure you aren't letting your PC access your SD card (go to Settings-->Connect to PC and change default to "Charge Only")
Once you've downloaded and unzipped them, open a command prompt (start menu, type "cmd" and type enter). Once in the command prompt, navigate to wherever you downloaded/extracted the zip. FROM THERE, type in each command in the writeup below EXACTLY AS WRITTEN (with quotation marks and everything). Once you've done the last ste (adb shell "/data/bin/root.sh") you can grab your device and open Titanium Backup and VOILA!
----
THE WRITE-UP
Type these commands AS WRITTEN into your cmd prompt after you've (1) downloaded superuser and Titanium Backup from the market (2) downloaded and extracted the zip and (3) navigated your command prompt to the location where you extracted those files.
adb push fre3vo /data/local/tmp/
adb shell "cd /data/local/tmp ; chmod 755 fre3vo ; ./fre3vo"
adb shell "mkdir /data/bin ; mv /data/local/tmp/fre3vo /data/bin/"
Click to expand...
Click to collapse
Looks great, yet i have a question..... In your instructions.....you make a command which I believe means to create a new folder.... You use "mkdir"........ I have a lot of
Or school DOS commands in my head and it reminds me of the MD make directory command... Is mkdir correct ?
mkdir is the long version of md, IIRC....
at first i wasn't gonna bother with temp root, but one of the things i did need was titanium backup to restore a bunch of data.
this worked absolutely perfect!
thanks for the great write up

accidentally move "/system/bin/sh" file on htc aria 2.2

Dear All,
I have been accidentally move the /system/bin/sh file to my SD card,
now, all my app which need root was not function..
What should I do now...?
Please help..... T_T
Move it back.
thankz for reply..
But, any suggestion to move back?
cause now I can't move it back via my phone file manager as the sh file was a
read only file..
Please advise any suggestion that how i can move back
really need advise...
peter tham said:
thankz for reply..
But, any suggestion to move back?
cause now I can't move it back via my phone file manager as the sh file was a
read only file..
Please advise any suggestion that how i can move back
really need advise...
Click to expand...
Click to collapse
You can probably use adb or Terminal Emulator (Free on market) directly on your phone.
Regards
SprigganMaster said:
You can probably use adb or Terminal Emulator (Free on market) directly on your phone.
Regards
Click to expand...
Click to collapse
Dear SprigganMaster,if I use terminal emulator,what was the initial command?
Cause the 'sh' file I move from system,it seem like a script ,and when I open the scree of emulator,I can't type any things...
For your info,I move the 'sh' file from /system /bin/ folder to my SD card /folder.
by using apk root explore,as a result,without the 'sh' script file in /system/bin folder,when I can't access to root explore anymore-force close.
Then I can't move back the 'sh' file to the system/bin folder.
All those root apk does not work anymore...
Now,I am trying my best to get a way to move back the 'sh' file (which is read only file) to my system folder...
Can u guide me about it? Using terminal emulator or any alternative way to move back the file into system?
Waiting your prompt reply and really appreciate it.
Thankz....^^
Hello peter tham,
Please note : my phone is not rooted. I can't try these solutions and I'm quite new to android. Maybe someone with more experience could help you.
I'm not sure if Terminal Emulator use the sh file too but we can try...
To move file, the command is mv.
To copy a file, the command is cp.
Adapt this command with the correct folder where you put the sh file :
Code:
cp /FOLDER/sh /system/bin/
You will need to be root to copy a file to /system folder.
Usually, to gain root privileges, you use the command su.
If Terminal Emulator does not work, you can try with adb.
1- Download sh file to your computer.
2- open a shell (on windows : cmd, on linux whatever you're using as shell)
3- plug your phone in Charge Only mode with USB debuging On
4- Push the file with a command like this one :
Code:
adb push foo.txt /sdcard/foo.txt
adb push <local> <remote>
You can find more info on adb here :
http://wiki.cyanogenmod.com/wiki/ADB
and here :
http://developer.android.com/guide/developing/tools/adb.html
Good Luck

[Q] problem when rooting nook tablet

my NT is not working, if you can please click here to help me
anyway, before that - when it was working, i tried to root it by using this method:
http://forum.xda-developers.com/showthread.php?t=1354487
at debloat menu, i chose "extreme" because i want to delete all of B&N content. i just want a normal android tablet, i know i can still read books by using the NOOK app for android.
so i chose extreme mode. and the command prompt window closed right after that.
so my NT was rooted, but not successfully, it was even worse than it was before i rooted.
i open the batch file (NookandZergy.bat) to see what the command lines are to find the reason why it didn't work. and i saw this:
adb shell rm -r /system/app/Accessories.apk
Click to expand...
Click to collapse
i opened command prompt, and typed this. and i got something like "failed because the file is not exist." -> i knew the batch script was wrong in some ways. i was going to unroot and root again with the option "full debloat" (not extreme), but before i do that, i was trying to remove netflix, i wanted to type this to the command line to see what will happen.
adb shell rm -r /system/app/netflix.apk
Click to expand...
Click to collapse
but i accidentally type adb shell rm -r /system/app/, and then it removed everything in /system/app/
i got the error in the nook tablet's screen, i don't remember what the error is, but when i pressed "force close", it kept showing me that error, i tried about 20 times but still not work.
i turned off my NT, and when i boot it, it stuck at "read forever",
that's why i created this thread.
my question is: how do i do "extreme debloat"? i want to remove everything from B&N. can you please give me the correct "command lines" to do this? and how to use that "command lines"?
prepare a sdcard to boot into ClockworkMod (CWM) which is a custom recovery (replaces stock recovery). And from there flash this ROM, for extreme-debloat is easy you can modify the script just to debloat or i can make it for you. First focus in restore your system.
As i said in my last post in your other thread read my FAQ and you will find your what you need there, if you have any question me or any other user will try to help.
PS: here is post i made for a user about how to re-bloat but the thing is that i post the list of all the B&N apps for reference to you so it might be helpfull.
~ Veronica
i have a little knowledge about batch file, so i think i can edit the script
(just edit the wrong file name -> make it become correct file name)
but i don't know what files are inside the folder /system/app/
for example: the file Accessories.apk is not exist, so how should i edit the script
nooktablet said:
i have a little knowledge about batch file, so i think i can edit the script
(just edit the wrong file name -> make it become correct file name)
but i don't know what files are inside the folder /system/app/
for example: the file Accessories.apk is not exist, so how should i edit the script
Click to expand...
Click to collapse
Well you got the error probably 'cause when you ran the script it removed that file so when you typed the same command again it won't remove it because is already gone.
In the link i provided is the list of all the B&N applications that are removed in the extreme debloat option. So you basically have keep that part of the code plus the intro to get in adb shell.
In that post you will also find a link to the complete system/app folder just in case you by "playing around" with adb remove any important system app, so you can push it back.
~ Veronica
lavero.burgos said:
Well you got the error probably 'cause when you ran the script it removed that file so when you typed the same command again it won't remove it because is already gone.
In the link i provided is the list of all the B&N applications that are removed in the extreme debloat option. So you basically have keep that part of the code plus the intro to get in adb shell.
In that post you will also find a link to the complete system/app folder just in case you by "playing around" with adb remove any important system app, so you can push it back.
Click to expand...
Click to collapse
no, when i chose extreme debloat, it closed the command prompt window, before it closed, i saw something "failed...". when i typed the command again it showed "failed...", i'm sure it's exactly what it said before,
and i know after debloat, it should go back and do other command like "thank you for using" (i read the batch file). i also saw B&N apps were still on my NT, debloat didn't work because of the missing file -> the script stopped.
btw, you said i can use adb to push the apps back. so that means i can also use adb to remove apps? can i not debloat when rooting, and after root, i use adb to remove apps later? will adb work at that time?
and can i use adb to explore what files are in the /system/app/ folder? or any other program?
nooktablet said:
no, when i chose extreme debloat, it closed the command prompt window, before it closed, i saw something "failed...". when i typed the command again it showed "failed...", i'm sure it's exactly what it said before,
and i know after debloat, it should go back and do other command like "thank you for using" (i read the batch file). i also saw B&N apps were still on my NT, debloat didn't work because of the missing file -> the script stopped.
btw, you said i can use adb to push the apps back. so that means i can also use adb to remove apps? can i not debloat when rooting, and after root, i use adb to remove apps later? will adb work at that time?
and can i use adb to explore what files are in the /system/app/ folder? or any other program?
Click to expand...
Click to collapse
Yes adb works at anytime even in dockworkers (CWM) .
To know how to use adb go to my FAQ (link below in my signature) and look in the how-to's made by me section for the how to use and install adb.
"adb shell rm -r" is one of the adb commands and is used for remove files.
adb shell = is to get superuser permissions (root/su)to run advanced commands.
rm = remove
-r = recursive
~ Veronica
Sent from my Nook Tablet using xda premium

Step by Step for ADB Push

I soft bricked my One. I have a rom to flash but have no idea how to push it via adb. I am downloading the Android SDK now but can someone point me to a very clear step by step tutorial on how to push via adb? Everything I find on the internet seems to be geared to those who are already familiar with command prompts. I am not.
thank you.
I wrote a primer about a year ago
http://forum.xda-developers.com/showthread.php?t=1754018
most of the instructions are universal though.
gunnyman said:
I wrote a primer about a year ago
http://forum.xda-developers.com/showthread.php?t=1754018
most of the instructions are universal though.
Click to expand...
Click to collapse
Thanks for the response, but I need to back up a little bit.
I go to start, type in cmd and then what? I have to switch users?
garment69 said:
Thanks for the response, but I need to back up a little bit.
I go to start, type in cmd and then what? I have to switch users?
Click to expand...
Click to collapse
Can somebody please help me. I have to get this phone up and running today.
garment69 said:
Thanks for the response, but I need to back up a little bit.
I go to start, type in cmd and then what? I have to switch users?
Click to expand...
Click to collapse
I cant get adb installed on my computer I think. When I go to start, cmd and type adb i get "adb is not a recognized command".
Run adb from the directory you installed it. Also on a mac put a./ dot slash in front of the command
garment69 said:
I cant get adb installed on my computer I think. When I go to start, cmd and type adb i get "adb is not a recognized command".
Click to expand...
Click to collapse
When I try and install the ADB exe from the zip file provided in your tutorial it says unable to start because ADBWinApi.dll is missing from my computer.
gunnyman said:
Run adb from the directory you installed it. Also on a mac put a./ dot slash in front of the command
Click to expand...
Click to collapse
Run adb from the directory I installed it? How?
garment69 said:
Run adb from the directory I installed it? How?
Click to expand...
Click to collapse
Find adb.exe in your hard drive. When you downloaded the sdk you unzipped the files somewhere.. I'm assuming you didn't add the path of adb.exe to your environment variables (if you did you would be able to type in adb commands from any directory in cmd prompt).
So navigate to driveletter:\adbdirectory\
From this directory you should be able to type in adb and get feedback
Sent from my HTC One using xda premium
born_fisherman said:
Find adb.exe in your hard drive. When you downloaded the sdk you unzipped the files somewhere.. I'm assuming you didn't add the path of adb.exe to your environment variables (if you did you would be able to type in adb commands from any directory in cmd prompt).
So navigate to driveletter:\adbdirectory\
From this directory you should be able to type in adb and get feedback
Sent from my HTC One using xda premium
Click to expand...
Click to collapse
I found the adb.exe and I ran it. A cmd window popped up for a second then vanished. I have no adb directory that I can find.
garment69 said:
I found the adb.exe and I ran it. A cmd window popped up for a second then vanished. I have no adb directory that I can find.
Click to expand...
Click to collapse
You don't run adb as an application, you run it in command prompt as an MS Dos command.
Adb is located in the tools directory of the sdk..not necessarily it's own directory. I was just saying to navigate to where that directory is from within cmd prompt.. I.e if adb.exe was located in c:\android, you would go to "cd c:\android" then run "adb commandhere"
Sent from my HTC One using xda premium
born_fisherman said:
You don't run adb as an application, you run it in command prompt as an MS Dos command.
Adb is located in the tools directory of the sdk..not necessarily it's own directory. I was just saying to navigate to where that directory is from within cmd prompt.. I.e if adb.exe was located in c:\android, you would go to "cd c:\android" then run "adb commandhere"
Sent from my HTC One using xda premium
Click to expand...
Click to collapse
thank you. I found a tutorial which instructed me to put the destination folder into environmental variables. Then I was able to get it to work.
Minor miracle I was able to get it to work!

Summoning Those with T-Mobile V521!

I'm trying to make an AOSP ROM, and while doing so, I now have a dysfunctional bootloader. If your tablet is rooted, please duplicate the boot.img from your system and share it with me. Would very much appreciate.
Instructions:
Use CMD and paste these 2 lines:
adb shell "dd if=/dev/block/platform/soc.0/by-name/boot of=/sdcard/boot.img"
adb pull /sdcard/boot.img
Then from ADB directory, upload to somewhere easily accessible.
Does it matter if we have updated to 7.0 or not? I'm rooted and have updated to 7.0 and would be happy to help.
That would actually be a good idea. The ROM is supposed to be 7.0.0 anyways.
Running the first command comes up as " no such file or directory"
Do you already have ADB?
mr_verystock said:
Do you already have ADB?
Click to expand...
Click to collapse
Yep. I do adb devices to make sure it recognizes the tablet and all is good there.
Maybe so I'm the same page i just open up ADB as normal : open the command prompt in my platform tools. I paste the first line in : adb shell "dd if=/dev/block/platform/soc.0/by-name/boot of=/sdcard/boot.img" I get no file or directory.
Unable to get the dumb file:
adb shell "dd if=/dev/block/platform/soc.0/by-name/boot of=/sdcard/boot.img"
dd: /dev/block/platform/soc.0/by-name/boot: No such file or directory
Edit: does a backup from the recovery could make the task done ? I backup the boot from the TWRP and I get a file of 32Mb with the name: boot.emmc.win
adb shell
cd /dev/block/platform
ls
And tell me the output. I appreciate your help!
mr_verystock said:
adb shell
cd /dev/block/platform
ls
And tell me the output. I appreciate your help!
Click to expand...
Click to collapse
Nothing, it returns an empty result
Unusual... Normally there's soc.0 or msm_sdcc.1.
mr_verystock said:
Unusual... Normally there's soc.0 or msm_sdcc.1.
Click to expand...
Click to collapse
That command never worked for me on this tablet. Yes the default kernels is 32mb.
You can get it from twrp backup as .win and then rename it (if it is not compressed) or use AUT or SuperR's kitchen to obtain it.
Another method would be flashifire>backup.
Im still on MM so I can not help you.
Try these: https://drive.google.com/file/d/0Bz54O_w1LEYpQ1k0aDVHX29NbkE/view?usp=sharing
the rooted files I grabbed from TWRP backup, should be idential to the ones get using dd method.
the stock files I extracted from stock kdz file using WindowsLGFirmwareExtract-1.2.6.1-Release

Categories

Resources