简体   繁体   English

将结果adb命令保存在set / p name =(蝙蝠文件)中

[英]Save result adb command in set /p name= (Bat file)

I want to save the result of the adb commands below as a variable in my script, but the result is wrong. 我想将以下adb命令的结果另存为脚本中的变量,但是结果是错误的。

adb shell getprop ro.product.brand

Output:Samsung 输出:三星

adb shell getprop ro.product.model

Output: SM-G920I 输出:SM-G920I

set /p Brand=adb shell getprop ro.product.brand
set /p Model=adb shell getprop ro.product.model
echo Brand: %Brand% Model: %Model% > Test.txt

But the result is: 但是结果是:

Brand: 0 Model: 0 

Any Suggestions? 有什么建议么?

With the help given in the comment I got the answer 在评论中给出的帮助下,我得到了答案

for /f "delims=" %%A in ('adb shell getprop ro.product.brand') do SET brand=%%A
for /f "delims=" %%B in ('adb shell getprop ro.product.model') do SET model=%%B
echo Marca\Modelo > Test.txt
echo %brand%\%model%  >> Test.txt

Answer 回答

Marca\Modelo 
samsung\SM-G920I  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM