码迷,mamicode.com
首页 > 移动开发 > 详细

批量安装/卸载手机apk--python语言

时间:2017-06-22 18:30:41      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:port   pac   卸载   批量   shell   批量安装   listdir   read   pre   

import os
import time

filedir = "D:\\app"

def install():
files = os.listdir(filedir)
for file in files:
text = os.popen("adb install -r D:\\app\\"+ file)
print "adb install "+file
print text.read()


def uninstall():
for packages in os.popen("adb shell pm list package -3").readlines():
packageName = packages.split(":")[-1].splitlines()[0]
if "google" not in packageName:
text = os.popen("adb uninstall " + packageName)
print "uninstall "+ packageName
print text.read()

def main():
install()
uninstall()


if __name__ == ‘__main__‘:
main()

批量安装/卸载手机apk--python语言

标签:port   pac   卸载   批量   shell   批量安装   listdir   read   pre   

原文地址:http://www.cnblogs.com/asin-huang/p/7066307.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!