program to move apps and data - General Questions and Answers

Is there a computer program that removes apps and data from one phone and reinstalls them onto another phone easier than trying to do it all "by hand", one app at a time?

You can achieve this by writing a Windows batch script that makes use of ADB commands adb backup and adb restore.

jwoegerbauer said:
You can achieve this by writing a Windows batch script that makes use of ADB commands adb backup and adb restore.
Click to expand...
Click to collapse
I appreciate the suggestion but is there any other way? I know not what a Windows batch script is or how to go about making one.

Fot the readers who know what a Windows batch script is, here an example that does the job
Code:
@echo off & setlocal
echo Unplug USB-connection between Android to get backed up and PC
echo When done press any key to continue ...
pause >nul
echo Connect Android with PC via USB
echo When done press any key to continue ...
pause >nul
adb devices
set /A cnt_pkg=0
for /F "tokens=2 delims=:" %%a in ('adb shell "pm list packages -3"') do (
set "pkg=%%a"
if NOT "?%pkg%"=="?" (
for /F "tokens=*" %%f in ('adb shell "pm dump %pkg% | grep 'ALLOW_BACKUP'"') do ( set "flags=%%f" )
if NOT "?%flags%"=="?" (
set /A cnt_pkg+=1
adb backup -f %USER%\%pkg%.backup -apk %pkg%
)
)
)
echo %cnt_pkg% user apps backed up
if %cnt_pkg% equ 0 ( goto :done )
echo Unplug USB-connection
echo When done press any key continue ...
pause >nul
echo Connect Android where apps should get restored to with PC via USB
echo When done press any key to continue ...
pause >nul
adb devices
set /A cnt_pkg=0
for /F "tokens=*" %%a in ('dir %USER%\*.backup /B') do (
set "bkup=%%a"
if NOT "?%bkup%"=="?" (
set /A cnt_pkg+=1
adb restore %USER%\%bkup%
)
)
echo %cnt_pkg% user apps restored
echo Press any key to continue ...
pause >nul
:done
endlocal & @echo on & exit

Related

[TOOL][WIN] Take screenshots of Recovery and Aroma

Support has ended, due to the possibility of pixel formats changing from each recovery update you receive.
But I did make a better Recovery Screenshot that handles this problem, and it can be found here or below.:cyclops:
http://forum.xda-developers.com/showthread.php?p=50029759​
This is a tool to get screenshots from Recovery or the Aroma Installer!
It's no big secret in the XDA community that you can use ffmpeg to convert your framebuffer to an image on some devices. I've found the ffmpeg values for the Nexus 7 2013, and made a batch script that lets you save as many screenshots as you would like in recovery or the aroma installer. This should work on all versions of Windows. I have only tested in Windows 7 and running the modified TWRP for multirom, which is based off of TWRP 2.6.3.1. It should work with regular TWRP as well as other recoveries. Please let me know if it works or not and what set up you have!!!
Why would anyone use this or do this?
Most people have actually no use for it whatsoever. It's pretty much useful for tutorials, showing anomalies, and showing off custom recovery themes. I needed to do it one time to show what I thought was an error in my recovery, but hadn't seen anyone post how to do it on the Nexus 7 2013, or any 1200x1920 device for that matter. While searching how to do this I came across this thread by @Whiskey103 :good: I learned a lot of useful information.
You have to have the adb drivers installed before you can do anything. Go here for more information.
This rar file contains the programs adb and ffmpeg. This ffmpeg is the newest 32-bit version from their downloads page. You must have adb.exe, ffmpeg.exe, and the two dll files for adb in the same directory as this batch when you run it. The easiest thing to do is just extract the rar to a new directory, then run the file named RUNrs.bat. The screenshots will be saved in the same folder you unzip everything as 'timestamp'.png.
Download Recovery Screenshot.rar
To see whats in the batch script hit the show more content button below. I don't recommend viewing it if you've ever used the phrase "cat your buffer" before:cyclops:
Code:
@ECHO OFF
CLS
TITLE Recovery Screenshot
MODE CON:COLS=54 LINES=40
COLOR 0B
SET TS=0
set "ffshowb=-hide_banner"
set "ffdebug=-loglevel fatal"
if "%~1"=="-d" (
REM @ECHO ON
set "ffdebug=-loglevel debug"
set "ffshowb=%"
MODE CON:COLS=140 LINES=250
COLOR 07
ECHO __________________________________________________________________
ECHO DEBUG INFO
ECHO __________________________________________________________________
)
:START
ECHO[
ECHO ______________________________________________________
ECHO This will pull a screenshot from your Nexus 7 2013
ECHO and save it to the directory that you ran this bat
ECHO file in. Connect USB ^& reboot into your recovery.
ECHO ______________________________________________________
ECHO Thanks to Whiskey103 for the idea!!
ECHO Written by makers_mark
ECHO ______________________________________________________
IF NOT EXIST ffmpeg.exe GOTO NOFILES
IF NOT EXIST adb.exe GOTO NOFILES
ADB kill-server -d >nul 2>&1
IF %TS%=="NOGOOD" GOTO SKIPPEDthatPause
ECHO Press any key when you are ready.
PAUSE >nul
:SKIPPEDthatPause
ECHO[
ECHO Pulling framebuffer from /dev/graphics/fb0
adb pull /dev/graphics/fb0 frmbfr >nul
IF ERRORLEVEL 1 (cls
SET TS="NOGOOD"
ECHO ______________________________________________________
ECHO Adb is not properly connected.
ECHO Try "Safely Removing" your N7 from your computer
ECHO Then unplug your usb cable, and reinsert it.
ECHO ______________________________________________________
ECHO[
ECHO[
ECHO Press any key to try again.
ECHO[
ECHO[
PAUSE >nul
CLS
GOTO START
)
SET TS=%DATE:/=%_%TIME::=_%
SET TS=%TS:.=%
SET TS=%TS: =%.png
FFMPEG %ffdebug% %ffshowb% -f rawvideo -vcodec rawvideo -pix_fmt rgb565 -s 1216x1920 -i frmbfr -vf crop=1200:1920:0:0 -vframes 1 -y %TS%
IF NOT EXIST %TS% GOTO ERRNE
DEL frmbfr >nul
ECHO ______________________________________________________
ECHO Screenshot saved as %TS%
ECHO ______________________________________________________
ECHO Press 1 or 2
ECHO 1 - Save another screenshot
ECHO 2 - Exit
ECHO ______________________________________________________
CHOICE /C:12 >nul
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF %K%==1 GOTO SKIPPEDthatPause
IF %K%==2 GOTO FINISH
:NOFILES
CLS
ECHO The directory that you are running this script in is:
ECHO %~dp0
ECHO[
ECHO You must run this script in the same directory as
ECHO adb.exe and ffmpeg.exe. Press any key to exit
PAUSE >nul
EXIT
:ERRNE
CLS
MODE CON:COLS=108 LINES=200
COLOR 07
FFMPEG -loglevel debug -f rawvideo -vcodec rawvideo -pix_fmt rgb565 -s 1216x1920 -i frmbfr -vf crop=1200:1920:0:0 -vframes 1 -y %TS%
ECHO ____________________________________________________________________________________________________________
ECHO There was a problem converting the framebuffer to a png file.
ECHO[
ECHO To capture the screen of the cmd window, hold down the alt key and press PrtSc on your keyboard. This
ECHO will save an image of the current window in memory on your clipboard. Then open paint or photoshop or
ECHO whatever program you use and hit ctrl+N to open a new file, then ctrl+V to paste an image. Save it and
ECHO please message me it or post in the XDA forum thread.
ECHO[
ECHO[
ECHO If you got to this screen and are not using a Nexus 7 2013, congratulations for successfully pulling
ECHO the framebuffer. To figure out the resolution to use, try adding 4,8,16, or 32 to your native width to
ECHO make room for the extra data, ioctrls?, at the end of each pixel row. Experiment with different pixel
ECHO formats also.
ECHO[
ECHO To see a list of all of the pix_fmts supported by ffmpeg, run ffmpeg -pix_fmts
ECHO[
ECHO Press 1 or 2
ECHO 1 - Show available pixel formats
ECHO 2 - Exit
CHOICE /C:12
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF %K%==1 (cls
MODE CON:COLS=52 LINES=200
ffmpeg -hide_banner -pix_fmts
pause
GOTO FINISH)
IF %K%==2 GOTO FINISH
:FINISH
ADB kill-server -d
EXIT
Thanks make my like easy now lol
sorry, wrong thread
Thanks!! :laugh:

[SCRIPT] Common ADB/FASTBOOT Functions

DISCLAIMER: I TAKE NO RESPONSIBILITY FOR DAMAGE CAUSED TO ANYONE OR ANYTHING BY USING MY SCRIPT. USE THIS AT YOUR OWN RISK.
So pretty much this is a script that can:
1. Flash a new boot animation without going through all the hassle of entering remounting commands. (Main reason why I wrote this) (Requires root and maybe adb insecure by chainfire)
2. Flash a new startup logo. (Requires unlocked bootloader)
3. Basic reboot commands with the press of a number.
4. Push and Pull files without entering commands, just need to specify the file location by dragging and dropping into the command window. (Some cases may need root. If your case does not need root, and the script says failed to restart adb as root, your command will still work, hopefully)
5. Install an apk the same way as 4. (If it says failed to restart as root it will still work in most cases)
6. Extremely noob friendly :laugh:.
Just a small little script to make your life a bit easier.
I tested this numerous times on a Moto G xt1032 running cyanogenmod 11 m4 and it showed no flaws. If this does not work for you try installing adb insecure by chainfire.
This works on windows only (I think).
If you find any bugs please tell me and I will try to fix even though I am just starting out with the wonders of developing. Some of the functions of the script need root access!
To use this, just copy and paste the lines below into a notepad window. Then save the file as something.bat Make sure to change the dropdown menu from txt document to all files when saving. Put the script in the folder where adb.exe and fastboot.exe are located. Double-click and enjoy!
Press "Click to show content" below!
@ECHO off
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo IF YOUR DEVICE IS LISTED BELOW TYPE 1
echo ELSE TYPE 2 TO EXIT
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb devices
SET /p startcheck= Type your choice:
if "%startcheck%" =="1" goto menu
if "%startcheck%" =="2" goto exit
:menu
cls
echo Type 0 for Device Check
echo Type 1 to Flash Boot Animation (ADB root required)
echo Type 2 to Flash Startup Logo
echo Type 3 to Reboot to Bootloader
echo Type 4 to Reboot
echo Type 5 to Pull a File
echo Type 6 to Push a File
echo Type 7 to Install Apk
echo Type 8 to Run ADB as Root
echo Type 9 to Browse and Copy Apps to Computer (ADB root required)
echo Type 10 to Browse and Copy SYSTEM Apps to Computer (ADB root required)
echo Type 11 to Exit
SET /p choice= Type your choice:
if "%choice%" =="0" goto devcheck
if "%choice%" =="1" goto anim
if "%choice%" =="2" goto logo
if "%choice%" =="3" goto rebootloader
if "%choice%" =="4" goto reboot
if "%choice%" =="5" goto adbpull
if "%choice%" =="6" goto adbpush
if "%choice%" =="7" goto apk
if "%choice%" =="8" goto adbroot
if "%choice%" =="9" goto apps
if "%choice%" =="10" goto sysapps
if "%choice%" =="11" goto exit
goto end
:end
cls
echo Type 1 to restart program
echo Type 2 to exit
SET /p restart= Type your choice
if "%restart%" =="1" goto menu
if "%restart%" =="2" goto exit
:exit
exit
:anim
cls
adb kill-server
adb start-server
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo IF YOUR DEVICE IS LISTED BELOW TYPE 1
echo ELSE TYPE 2 TO EXIT
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb devices
SET /p adb= Type your choice
if "%adb%" =="2" goto menu
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR YOUR bootanimation.zip
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p bapath= Type your path here and press enter:
cls
adb wait-for-device root
timeout -t 1 > nul
echo Remounting system in read-write mode!
adb wait-for-device remount
timeout -t 2 > nul
adb wait-for-device shell "su -c 'mount -o rw,remount -t yaffs2 /dev/block/mtdblock1 /system'"
echo Deleting existing bootanimation!
adb wait-for-device shell "su -c 'rm /system/media/bootanimation.zip'"
echo Sending new bootanimation!
adb push %bapath% /system/media
echo Remounting system in read-only mode!
adb wait-for-device shell "su -c 'mount -o ro,remount -t yaffs2 /dev/block/mtdblock1 /system'"
echo Done!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Press 1 to reboot!
echo Press 2 to exit!
SET /p dm= Type your choice
if "%dm%" =="1" goto reboot
if "%dm%" =="2" goto end
:logo
cls
echo Rebooting to bootloader...
adb reboot-bootloader
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo When device is in bootloader press any key to continue!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PAUSE
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo IF YOUR DEVICE IS LISTED BELOW TYPE 1
echo ELSE TYPE 2 TO EXIT
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fastboot devices
SET /p fbdev= Type your choice
if "%fbdev%" =="2" goto menu
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR YOUR logo.bin
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p lopath= Type your path here and press enter:
cls
echo Sending new logo!
fastboot flash logo %lopath%
echo Rebooting...
fastboot reboot
echo Done!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Press any key to return to menu!
PAUSE
goto menu
:reboot
cls
adb reboot
echo Rebooting...
timeout -t 3 > nul
goto menu
:rebootloader
cls
adb reboot-bootloader
echo Rebooting to bootloader...
timeout -t 3 > nul
goto menu
:adbpull
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR THE FILE TO PULL
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p adbpullpath= Type your path here and press enter:
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR THE FILE TO SAVE
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p adbpullsave= Type your path here and press enter:
cls
echo !!!IF THIS ACTION NEEDS ROOT RUN OPTION 8 FROM MENU FIRST!!!
timeout -t 2 > nul
echo Pulling File!
adb wait-for-device pull %adbpullpath% %adbpullsave%
echo Done!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Press any key to return to menu!
PAUSE
goto menu
:adbpush
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR THE FILE TO PUSH
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p adbpushpath= Type your path here and press enter:
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR THE DIRECTORY TO PUSH TO
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p adbpushsave= Type your path here and press enter:
cls
echo !!!IF THIS ACTION NEEDS ROOT RUN OPTION 8 FROM MENU FIRST!!!
timeout -t 2 > nul
echo Pushing File!
adb wait-for-device push %adbpushpath% %adbpushsave%
echo Done!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Press any key to return to menu!
PAUSE
goto menu
:apk
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo IF YOUR DEVICE IS LISTED BELOW TYPE 1
echo ELSE TYPE 2 TO EXIT
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb devices
SET /p apkcheck= Type your choice
if "%apkcheck%" =="2" goto exit
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR THE APK TO INSTALL
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p apkinstall= Type your path here and press enter:
cls
echo !!!IF THIS ACTION NEEDS ROOT RUN OPTION 8 FROM MENU FIRST!!!
timeout -t 2 > nul
echo Installing Apk!
adb wait-for-device install %apkinstall%
echo Done!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Press any key to return to menu!
PAUSE
goto menu
:devcheck
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo DEVICE CONNECTION CHECK
echo Your device should be listed below!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb devices
PAUSE
goto menu
:adbroot
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Trying to run ADB as root!
adb wait-for-device root
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo !!!ONCE DEVICE RECONNECTS TO COMPUTER PRESS ANY KEY TO GET TO MENU!!!
PAUSE
goto menu
:apps
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb wait-for-device shell "su -c 'ls /data/app'"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Do you want to copy an app to the computer?
set /p appans= (Y or N):
if "%appans%" =="N" goto menu
if "%appans%" =="n" goto menu
if "%appans%" =="no" goto menu
if "%appans%" =="No" goto menu
if "%appans%" =="NO" goto menu
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb wait-for-device shell "su -c 'ls /data/app'"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Type the app's name EXACTLY including the .apk extension
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set /p appcp= Type the name EXACTLY as it appears:
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Type the destination directory
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set /p appdd= Destination Directory:
cls
echo Copying App!
adb pull /data/app/%appcp% %appdd%
echo Done!
PAUSE
goto menu
:sysapps
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb wait-for-device shell "su -c 'ls /system/app'"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Do you want to copy an app to the computer?
set /p sappans= (Y or N):
if "%sappans%" =="N" goto menu
if "%sappans%" =="n" goto menu
if "%sappans%" =="no" goto menu
if "%sappans%" =="No" goto menu
if "%sappans%" =="NO" goto menu
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb wait-for-device shell "su -c 'ls /system/app'"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Type the app's name EXACTLY including the .apk extension
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set /p sappcp= Type the name EXACTLY as it appears:
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Type the destination directory
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set /p sappdd= Destination Directory:
cls
echo Copying App!
adb pull /system/app/%sappcp% %sappdd%
echo Done!
PAUSE
goto menu

[SCRIPT] Bootanimation.zip Flasher

This is a simple script that automatically flashes a new boot animation. It does the remount and deletion commands automatically to provide an easy and fast way to flash boot animations.
ADB ROOT command must be functioning for this to work properly.
DISCLAIMER: THE CREATOR IS NOT RESPONSIBLE FOR DAMAGE CAUSED BY THE USE OF THIS SCRIPT! USE THIS AT YOUR OWN RISK!!!
1. Copy the code below into a new notepad window.
2. Save the file as bootanimation flasher.bat in the folder where adb and its components are located. (MAKE SURE YOU HAVE THE .bat EXTENSION)
3. Run the script!
Common Errors:
"error protocol failure" - this error occurs when the command adb root did not function properly. Fix the issue and try again. Try and re-enable usb debugging if it still doesn't work.
Try and use this app to get adb root functioning: http://forum.xda-developers.com/showthread.php?t=1687590
This was tried and tested with success on a oneplus one and a moto g (1st gen)
Script (click button to show):
@echo off
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo ROOT ACCESS IS REQUIRED. ADB ROOT COMMAND MUST BE FUNCTIONING.
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo THE CREATOR OF THIS SCRIPT IS NOT RESPONSIBLE FOR ANY DAMAGE!
echo USE THIS AT YOUR OWN RISK!!!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PAUSE
cls
echo Starting ADB!
adb kill-server > nul
adb start-server > nul
echo Done!
timeout -t 1 > nul
:menu
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo IF YOUR DEVICE IS LISTED BELOW TYPE 1
echo TYPE 2 TO TRY AGAIN
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adb devices
SET /p startcheck= Type your choice:
if "%startcheck%" =="1" goto ask
if "%startcheck%" =="2" goto menu
goto menu
:ask
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE 1 TO FLASH BOOTANIMATION!
echo TYPE 2 TO BACKUP EXISTING BOOTANIMATION THEN FLASH!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p askbackup= Type your choice:
if "%askbackup%" =="1" goto anim
if "%askbackup%" =="2" goto backup
goto menu
:backup
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH TO BACKUP BOOTANIMATION TO!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p backuppath= Type your path and press enter:
cls
echo Backing Up!
adb pull /system/media/bootanimation.zip %backuppath%
echo Done
PAUSE
goto anim
:anim
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo TYPE THE PATH FOR YOUR bootanimation.zip
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET /p bapath= Type your path here and press enter:
cls
echo Running command adb root...
adb wait-for-device root > nul
timeout -t 1 > nul
echo Success, Root Access obtained!
echo Remounting system in read-write mode!
adb wait-for-device remount > nul
timeout -t 1 > nul
adb wait-for-device shell "su -c 'mount -o rw,remount -t yaffs2 /dev/block/mtdblock1 /system'"
echo Remount Succeded!
echo Deleting existing bootanimation!
adb wait-for-device shell "su -c 'rm /system/media/bootanimation.zip'"
echo Sending new bootanimation!
adb push %bapath% /system/media
echo Remounting system in read-only mode!
adb wait-for-device shell "su -c 'mount -o ro,remount -t yaffs2 /dev/block/mtdblock1 /system'"
echo Done!
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Press 1 to Reboot!
echo Press 2 to Exit!
SET /p dm= Type your choice
if "%dm%" =="1" goto reboot
if "%dm%" =="2" goto exit
:reboot
cls
echo Rebooting!
adb reboot
timeout -t 1 > nul
PAUSE
:exit
exit

Question Is it possible to do a factory reset without data loss?

Is it possible to do a factory reset without data loss?
To uninstall all apps installed for Android's actual user ( default user 0 ) in one go and also backup actual user's data you can run a Windows CMD script what looks like this draft:
Code:
@echo off & setlocal
set "pc_bkup_fldr=C:\ANDROID-USER-DATA-BKUP"
rem add timestamp in ISO 8601 format to backup folder
for /F "tokens=2 delims==" %%a in ('wmic os get localdatetime /VALUE 2^>NUL') do ( set "datetime=%%a" )
if not "?%datetime%"=="?" (
for /F "tokens=1 delims=." %%a in ("%datetime%") do ( set "retval=%%a" )
if not "?%retval%"=="?" (
set yyyy=%retval:~0,4%
set mm=%retval:~4,2%
set dd=%retval:~6,2%
set "pc_bkup_fldr=%pc_bkup_fldr%-%yyyy%-%mm%-%dd%"
)
)
for /F "skip=1" "tokens=*" %%a in ('adb devices 2^>nul') do ( set "retval=%%a" )
if "?%retval%"=="?" ( goto :end )
mkdir "%pc_bkup_fldr%" 2>nul >nul
rem retrieve user id
for /F %%a in ('adb shell "am get-current-user"') do ( set "uid=%%a" )
rem Below command will return all the android user-app packages installed
rem on the connected Android device.
for /F "tokens=2 delims=:" %%a in ('adb shell "pm list packages --user %uid% -3"') do (
set "pkg_name=%%a"
if not "?%pkg_name%"=="?"
rem clear all application data (including application cache)
adb shell "pm clear --user %uid% %pkg_name%"
rem uninstall app by app package name
adb shell "pm uninstall --user %uid% %pkg_name%"
timeout /t 2 /nobreak >nul
)
)
rem Next command will return all the android user-data stored in /sdcard
rem partition of the connected Android device.
set "int_sdcard=/storage/emulated"
for /F "skip=1" "tokens=1,9 delims= " %%a in ('adb shell "ls -l %int_sdcard%/%uid%"') do (
set "dir_flag=%%a" & set "dir_name=%%b"
if not "?%dir_flag%"=="?"" (
echo %dir_flag% | findstr /C:"d" >nul
if %errorlevel% equ 0 (
set "data_fldr=%int_sdcard%/%uid%/%dir_name%"
rem backup the folder to pc
adb exec-out "tar -c %data_fldr%" > "%pc_bkup_fldr%\%dir_name%.tar"
rem delete contents of Android folder
adb shell "rm -f %data_fldr%/*"
timeout /t 2 /nobreak >nul
)
)
)
rem Next command reboots Android thus changes made take effect
adb reboot
:end
endlocal & @echo on
exit
DL: https://www.mediafire.com/file/b2qkflgiqhcni8i/my-factory-reset.bat/file
monica lewinsky said:
Is it possible to do a factory reset without data loss?
Click to expand...
Click to collapse
No
mah dude is confused factory reset is basically wiping your data partition
ineedroot69 said:
mah dude is confused factory reset is basically wiping your data partition
Click to expand...
Click to collapse
ROFL
jwoegerbauer said:
To uninstall all apps installed for Android's actual user ( default user 0 ) in one go and also backup actual user's data you can run a Windows CMD script what looks like this draft:
Code:
@echo off & setlocal
set "pc_bkup_fldr=C:\ANDROID-USER-DATA-BKUP"
rem add timestamp in ISO 8601 format to backup folder
for /F "tokens=2 delims==" %%a in ('wmic os get localdatetime /VALUE 2^>NUL') do ( set "datetime=%%a" )
if not "?%datetime%"=="?" (
for /F "tokens=1 delims=." %%a in ("%datetime%") do ( set "retval=%%a" )
if not "?%retval%"=="?" (
set yyyy=%retval:~0,4%
set mm=%retval:~4,2%
set dd=%retval:~6,2%
set "pc_bkup_fldr=%pc_bkup_fldr%-%yyyy%-%mm%-%dd%"
)
)
for /F "skip=1" "tokens=*" %%a in ('adb devices 2^>nul') do ( set "retval=%%a" )
if "?%retval%"=="?" ( goto :end )
mkdir "%pc_bkup_fldr%" 2>nul >nul
rem retrieve user id
for /F %%a in ('adb shell "am get-current-user"') do ( set "uid=%%a" )
rem Below command will return all the android user-app packages installed
rem on the connected Android device.
for /F "tokens=2 delims=:" %%a in ('adb shell "pm list packages --user %uid% -3"') do (
set "pkg_name=%%a"
if not "?%pkg_name%"=="?"
rem clear all application data (including application cache)
adb shell "pm clear --user %uid% %pkg_name%"
rem uninstall app by app package name
adb shell "pm uninstall --user %uid% %pkg_name%"
timeout /t 2 /nobreak >nul
)
)
rem Next command will return all the android user-data stored in /sdcard
rem partition of the connected Android device.
set "int_sdcard=/storage/emulated"
for /F "skip=1" "tokens=1,9 delims= " %%a in ('adb shell "ls -l %int_sdcard%/%uid%"') do (
set "dir_flag=%%a" & set "dir_name=%%b"
if not "?%dir_flag%"=="?"" (
echo %dir_flag% | findstr /C:"d" >nul
if %errorlevel% equ 0 (
set "data_fldr=%int_sdcard%/%uid%/%dir_name%"
rem backup the folder to pc
adb exec-out "tar -c %data_fldr%" > "%pc_bkup_fldr%\%dir_name%.tar"
rem delete contents of Android folder
adb shell "rm -f %data_fldr%/*"
timeout /t 2 /nobreak >nul
)
)
)
rem Next command reboots Android thus changes made take effect
adb reboot
:end
endlocal & @echo on
exit
DL: https://www.mediafire.com/file/b2qkflgiqhcni8i/my-factory-reset.bat/file
Click to expand...
Click to collapse
thanks for this. it's exactly i was looking for.

How do you backup the stock rom

Hi everyone sorry for this question but haven't been able to find any info on backing up the stock rom of a device.
It is a Samsung so not sure if fastboot would be an option and yet to install any recovery image (TWRP)
Please advise what would be the best way before installing a custom ROM for backing up the stock roms of the device.
I also want to backup the recovery before adding a customer recovery if possible.
Thanks for any help
Only for demonstration purpose:
Here excerpt of a Windows CMD script I times ago wrote to fully backup a phone by means of ADB
Code:
rem THIS DOESN'T WORK ON MTK-CHIPSET BASED DEVICES!
rem
rem for MTD and EMMC devices, the partition layout and the partition names
rem can be retrieved by reading the /proc/mtd and /proc/emmc files.
set file_to_query=
for /F %%a in ('adb shell "[ -f /proc/mtd ]; echo $?"') do (
set "error=%%a"
if "%error%"=="0" (
set "part_layout=mtd"
set "file_to_query=/proc/%part_layout%"
)
)
if not defined file_to_query (
for /F %%a in ('adb shell "[ -f /proc/emmc ]; echo $?"') do (
set "error=%%a"
if "%error%"=="0" (
set "part_layout=emmc"
set "file_to_query=/proc/%part_layout%"
)
)
)
if not defined file_to_query ( goto :failed )
for /F "skip=1" "tokens=1,4 delims= " %%a in ('adb shell "cat %file_to_query%"') do (
rem get dev-name and corresponding part-name
set "dev_name=%%a" & set "part_name=%%b"
if not "?%dev_name%"=="?" (
rem remove colon
set "dev_name=%dev_name::=%"
rem remove double quotes
set "part_name=%part_name:"=%"
rem write out dump to pc
adb exec-out "dd if=/dev/%part_layout%/%dev_name% bs=4096" > "C:\%part_name%.img"
timeout /t 2 /nobreak >nul
)
)
:failed
From what I have read phone needs to be rooted to complete the backup via adb

Categories

Resources