Common Android batch commands


Common batch commands

:: = a place you can write a comment that will not run in the script.

> = redirects the output to another location. Example adb devices > deviceserialnumber.txt

title = the name you give your script. Example = title Amazon Fire TV Tool

echo off = the CDM window only shows the output of a command and not the command itself.

mode = used to set the size of the CMD window. Example mode con:cols=67 lines=14

color = the color of the CMD text. Example color 0b

call = calls a menu or different location in the script. Example call:menu_1

GOTO = GOTO a menu or different location in the script. Example GOTO:menu_1

echo = the CMD window will show anything written after it. Example echo whats up will display whats up

:menu_1 = a location in a script that can be called with GOTO or call commands.

find This batch command searches for a string in files or input, outputting matching lines.

cls = clear everything that is on the CMD window screen.

timeout = start a timer then continue script once the time is up. Example timeout 8 will run for 8 seconds.

pause = stops the script and ask the user to press any key to continue.

pause > nul = do not show the output of this command.

EOF = END OF FILE. Example GOTO:EOF

start = use this command to start a program. Example start https://google.com will open up google in a browser.

Exit = exit and close CMD window.


ADB and Fastboot commands.

adb devices = see what devices are connected to adb

adb kill-server = stop adb server

adb start-server = start adb server

adb reboot recovery = reboot device to recovery

adb reboot bootloader = reboot device to bootloader mode.

adb install Superuser.apk = install a app

adb shell = open a shell on the device over adb

adb shell pm disable com.amazon.dcp = open shell and call the pm file on the device in the system/bin folder then use the pm files command which is disable to disable the app.

adb shell su -c “pm disable com.amazon.dcp” = same as above but this time we added the su -c which is requesting root to run the command.

adb shell su -c “rm -f /cache/*.zip” = rm -f deletes a file

adb push stock-recovery.img /sdcard/ = push a file from one location to the device and in this case to the SDCARD

adb pull system/build.prop = Pull a file from the device to your computer like the build.prop

adb shell su -c “chmod 777 /cache/recovery” = chmod a file. check the read write of the file

adb shell su -c “echo ‘–update_package=/cache/update.zip’ > /cache/recovery/command” = with this command we are writing the line –update_package=/cache/update.zip the the command file.

adb shell su -c “dd if=/sdcard/stock-recovery.img of=/dev/block/platform/msm_sdcc.1/by-name/recovery” = DD is the command i want you to see here and it can be used only with su -c which is root and it can copy or delete anything. in this example we are backing up the recovery.img

adb shell su -c “/data/local/tmp/aftv-unlock unlock” = this is a method to execute a .sh file that is on the device already. in this example that .sh script is the aftv-unlock file with command unlock.


fastboot devices

fastboot reboot bootloader

fastboot getvar all

fastboot reboot

fastboot oem unlock bootloader

fastboot flash recovery recovery.img

fastboot -w

fastboot format userdate

fastboot boot boot.img


Other great resources

https://ss64.com/nt/

http://www.trytoprogram.com/batch-file/