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?
I can currently list out all 3rd party apps through
adb shell pm list packages -3
Could I somehow direct the list of packages this generates into an uninstall command in adb
?
Go to the Security section of your Google Account. Under “Third-party apps with account access,” select Manage third-party access. Select the app or service you want to remove. Select Remove Access.
Try:
adb shell pm list packages -3 | cut -d':' -f2 | tr '\r' ' ' | xargs -r -n1 -t adb uninstall
:
r
option will prevent xargs from running the command if there are no third party apps installedn1
option is to pass one result value as argument at a time to the commandt
is for printing the command being executed)Hope it helps!!!
What seems to be the problem? It can be done with this one-liner:
adb shell "pm list packages -3 | cut -c9- | xargs pm uninstall"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With