How to execute the adb commands in python scripts
This is pretty easy. Just use a loop!
for x in list:
os.system("adb install " + x)
That's it!
Also, for this to work, you need adb to be added to your PATH variable.
For information regarding how to do it, see here.
How to open adb shell and execute commands inside shell using python
Found a way to do it using communicate() method in subprocess module
procId = subprocess.Popen('adb shell', stdin = subprocess.PIPE)
procId.communicate('command1\ncommand2\nexit\n')
Using python to execute adb commands
cmd
is a method of the Adb
Python class, which allows you to execute commands on the previously selected device.
How to run two adb shell commands via Python, but store output of only one?
There is no reason for running both commands in the same shell
session:
print subprocess.check_output(["adb", "shell", "du -sh /sdcard/qpython"])
subprocess.check_output(["adb", "shell", "rm -r /sdcard/qpython"])
Related Topics
How to Control Navigationview Margin Between Menu Items
Error Androidmanifest.Xml Doesn't Exist or Has Incorrect Root Tag
How to Separate a Country Code from a Phone Number in Android
How to Access the Camera from Within a Webview
How to Get the Current Time on a Button Click
How to Execute Adb Commands Through My Android App
Getting Net::Err_Connection_Refused (Http://Localhost:8080) on Android 4.4.2 Version
Not Opening Specific Activity on Notification Click When the App Is in Background/Not Running
What Is the Simplest and Most Robust Way to Get the User'S Current Location on Android
Cart Item Count Increment/Decrement & Add to Cart
Remove Old Fragment from Fragment Manager
Remove Span Tag With Text from String
Android Studio - How to Find Valid Certification Path to Requested Target
Changing Background Color of the Layout on a Button Click in Android