I would like to disable all USER applications on an Android phone. Disabling all these applications one by one will take some time. Is there a command I can use via the ADB shell interface to disable them?
解决方案
This command should work on all Android versions (but I do not have anything older than 5.1 to test with):
adb shell "for p in $(pm list packages -3); do pm disable ${p:8}; done"
On Android 7.0+ you could use slightly faster:
adb shell "for p in $(cmd package list packages -3); do pm disable ${p:8}; done"
And if disabling the package is not enough - you can uninstall it with:
adb shell "for p in $(cmd package list packages -3); do pm uninstall ${p:8}; done"
To escape the $ when running the commands under Linux/macOS use ' instead of ".
|