本文介绍了如何使用adb卸载所有第三方用户应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建一个脚本,该脚本将通过 adb 一次批量检索和卸载所有用户应用程序。有人知道我将如何做到吗?
I am trying to create a script that will retrieve and uninstall all user apps in one batch operation through adb. Does anyone know how I would be able to do this?
我目前可以通过
adb shell pm list packages -3我能以某种方式将生成的软件包列表定向到 adb ?
Could I somehow direct the list of packages this generates into an uninstall command in adb?
推荐答案尝试:
adb shell pm list packages -3 | cut -d':' -f2 | tr '\r' ' ' | xargs -r -n1 -t adb uninstall
- 第一部分是获取第三方应用程序包的名称
- 第二部分是使用定界符来分割软件包名称:
- 第三部分是替换回车符带有空间(有时在linux机器上会是个问题。尝试删除此部分并检查是否面对它)
- 最后一个是用于逐个卸载
- r 选项将阻止xargs在未安装第三方应用程序的情况下运行命令
- n1 选项是一次将一个结果值作为参数传递给命令
- t 用于打印正在执行的命令)
- First part is to get 3rd party app package names
- second part is to split package names using delimiter :
- third part is to replace carriage return with space (sometimes it would be a problem in linux machines. Try removing this part and check if you face it)
- and the last one is for uninstalling one by one
- r option will prevent xargs from running the command if there are no third party apps installed
- n1 option is to pass one result value as argument at a time to the command
- t is for printing the command being executed)
希望有帮助!
更多推荐
如何使用adb卸载所有第三方用户应用程序?
发布评论