Home > Mobile >  How to display my device Infomation on cmd(using adb)
How to display my device Infomation on cmd(using adb)

Time:08-15

I want make batch file using adb and prompt

For instance: I need Huawei P40 info from batch:

P40
Model : ANA-AN00
OS : 12
Build Type : User
Build Number : P40Blahblahblah
sdk version : blahblah

like this.
I can saw on adb (adb shell getprop ro.blahblah) but I can't make to batch file.
I weak to CLI... pls help me

CodePudding user response:

You need to grep the values returns by adb shell getprop as in here.

For each value, you can set it in a variable, and then print it with the format you want.

Example:

model=$(adb shell getprop | grep model | cut -d ":" -f 2)
# Or, simpler
model=$(adb shell getprop ro.product.model)
echo "model='${model}'"
  • Related