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
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}'"
The OP 강승오 adds in the comments:
I got app ver from '
adb shell dumpsys package mypackage | grep"'versionName="
' and I checked I want to displayApp ver : 1.2.345
but, displayed on resultApp ver : versionName=1.2.345
.
how to solve this?
I triedset str
commandset str:%str:versionName=:%
after then nothing displayed on app verapp ver :
(blank).
If you have set that result to a variable, you can replace the part you don't want:
res=$(adb shell dumpsys package mypackage | grep"'versionName=")
res=${res/versionName=/}
echo "res='${res}'