如何将命令输出的一部分重定向到变量? [英] How do I redirect a portion of a command's output to a variable?
本文介绍了如何将命令输出的一部分重定向到变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我运行bcdedit /enum
时,它为我提供以下信息:
When I run bcdedit /enum
, it presents me with the following information:
Windows Boot Loader
-------------------
identifier {current}
device partition=C:
path \Windows\system32\winload.exe
description Windows 8
locale en-US
inherit {bootloadersettings}
recoverysequence {8a06a568-8489-11e3-9c06-bb2fddc43414}
integrityservices Enable
recoveryenabled Yes
allowedinmemorysettings 0x15000075
osdevice partition=C:
systemroot \Windows
resumeobject {8a06a566-8489-11e3-9c06-bb2fddc43414}
nx OptOut
bootmenupolicy Standard
hypervisorlaunchtype Off
如何获取当前设置为off
的字符串"hypervisorlaunchtype"并将其通过管道传递给另一个命令?
How can I get the string of "hypervisorlaunchtype", which is currently set to off
and pipe it to another command?
推荐答案
像这样:
@echo off
FOR /F "tokens=2" %%a in ('bcdedit /enum ^| find /i "hypervisorlaunchtype"') do set $switch=%%a
echo hypervisor launch-type is [%$switch%]
这篇关于如何将命令输出的一部分重定向到变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文