Grepping`章query`结果值? [英] Grepping `reg query` result value?
本文介绍了Grepping`章query`结果值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑从一个假设的章查询
以下结果:
Consider the following result from a hypothetical reg query
:
..>reg query HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MediaPlayer /v "I
nstallation Directory"
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MediaPlayer
Installation Directory REG_EXPAND_SZ %ProgramFiles%\Windows Media Play
er
我如何用grep的输出,这样我可以指定设置的实际值(的%ProgramFiles%\\ ...
)到一个变量(或临时文件) ?
How do I grep the output so that I can assign the actual value of the setting (%ProgramFiles%\...
) into a variable (or temp file)?
推荐答案
例如批处理文件:
@FOR /F "tokens=2* " %%A IN ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MediaPlayer /v "Installation Directory"') DO @SET PARAM=%%B
如果您想直接在控制台使用它 - 用百分号表示变量(即%A
和%B
)
If you want to use it directly in console - use single percent sign to denote variables (i.e. %A
and %B
)
这篇关于Grepping`章query`结果值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文