Android – ADB Shell Batch Scripting – Automate SQLite Database Copy

This is a quick blog to represent tips on how one could run multiple adb shell commands as part of one windows batch script or automate SQLite database copy to local filesystem.

Say, you have got to copy the SQLite database from within your app to your local filesystem. The commands could be found on one of my earlier blog:

Copy following commands in a text file, say, commands.txt

  • run-as package-name-of-the-app
  • chmod 666 databases/database_name
  • exit
  • cp /data/data/package-name-of-app/databases/database_name /sdcard/
  • run-as¬†package-name-of-the-app
  • chmod 600 databases/database_name
  • exit
  • exit

Write following set of commands in another batch script (.bat file) and name it as, say, adb.bat.

  • del database_name
  • cmd /c adb shell < commands.txt
  • cmd /c adb pull /sdcard/database_name .

Go to command prompt and execute the batch script, adb.bat. That is it. You shall have databases copied on to your local filesystem.


Ajitesh Kumar
Follow me

Ajitesh Kumar

I have been recently working in the area of Data Science and Machine Learning / Deep Learning. In addition, I am also passionate about various different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia etc and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data etc. I would love to connect with you on Linkedin.
Posted in Android, Mobility. Tagged with .

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.