从批处理文件FASTBOOT getvar [英] fastboot getvar from batch file

查看:1919
本文介绍了从批处理文件FASTBOOT getvar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从一个批处理文件中获取一定的FASTBOOT变量。我用的是这样的:

I was trying to get certain fastboot variables from a batch file. I was using something like :

for /f "tokens=2 delims=:" %%a in ('fastboot.exe getvar version-bootloader') do @echo version is %%a

但我得到的命令行输出,而不是在变量%%一个。命令'fastboot.exe getvar版本的bootloader完全在命令行。我也尝试过这样做的:

But I get the output on command line, not in the variable %%a. the command 'fastboot.exe getvar version-bootloader' works perfectly in command-line. I also tried doing:

fastboot.exe getvar version-bootloader >> temp.txt

但TEMP.TXT始终是空的,我收到的文件,而不是在命令行上输出。有没有这样的一个选择吗?

but temp.txt is always empty and i receive the output on the command line, instead of the file. Is there an alternative to this?

推荐答案

FASTBOOT输出定向加入 2 - 错误流,可以直接错误流标准流;&放大器; 1

fastboot output is directed to error stream, you can direct error stream to standard stream by adding 2>&1


  1. 您的脚本将获得两行,因为FASTBOOT getvar返回更多符合经过时间。

  2. 您的脚本分析与一家领先的空间版本,您768,16添加一个空间分隔符(这是默认的,但是当你给delims将被覆盖)

你应该使用:

for /f "tokens=2 delims=: " %%a in ('fastboot.exe getvar version-bootloader 2^>^&1 ^| findstr version') do @echo version is %%a

这篇关于从批处理文件FASTBOOT getvar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆