adb命令获取、设置、删除配置项

发布时间 2024-01-04 13:05:24作者: 悟透

前言全局说明

settings 是对 Android 里设置进行 增、删、改、查


一、帮助

adb shell settings
Settings provider (settings) commands:
  help
      Print this help text.
  get [--user <USER_ID> | current] NAMESPACE KEY
      Retrieve the current value of KEY.
  put [--user <USER_ID> | current] NAMESPACE KEY VALUE [TAG] [default]
      Change the contents of KEY to VALUE.
      TAG to associate with the setting.
      {default} to set as the default, case-insensitive only for global/secure namespace
  delete [--user <USER_ID> | current] NAMESPACE KEY
      Delete the entry for KEY.
  reset [--user <USER_ID> | current] NAMESPACE {PACKAGE_NAME | RESET_MODE}
      Reset the global/secure table for a package with mode.
      RESET_MODE is one of {untrusted_defaults, untrusted_clear, trusted_defaults}, case-insensitive
  list [--user <USER_ID> | current] NAMESPACE
      Print all defined keys.
      NAMESPACE is one of {system, secure, global}, case-insensitive

二、列出 list

adb shell settings list system
adb shell settings list secure
adb shell settings list global

可以用 list 命令,列出配置文件里有哪些配置项。
根据配置项的键 来修改值
如果没有你需要的键,直接写上就可以创建

更多示例:https://www.cnblogs.com/wutou/p/17930583.html


三、获取 get

adb shell settings get system
adb shell settings get secure
adb shell settings get global

四、更新 put

adb shell settings put system
adb shell settings put secure
adb shell settings put global

五、删除

adb shell settings delete system
adb shell settings delete secure
adb shell settings delete global

六、恢复默认 reset

adb shell settings reset system
adb shell settings reset secure
adb shell settings reset global



免责声明:本号所涉及内容仅供安全研究与教学使用,如出现其他风险,后果自负。




参考、来源: