如何读取从批处理文件注册表字符串值 [英] how to read registry string value from batch file
本文介绍了如何读取从批处理文件注册表字符串值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想读注册表字符串值,从bat文件,然后assing的readed值变量。
我试过如下:
I want to read registry string value, from bat file, and then assing the readed value to variable. I tried the following :
FOR %%a in ('REG QUERY HKLM\SOFTWARE\MathWorks\MATLAB\7.10 /v MATLABROOT') DO set MATLAB=%%a
echo %MATLAB%
,但它不工作
推荐答案
如果该值(在这种情况下,巴兹)的名称不包含空格,你可以这样做
If the name of the value (baz in this case) does not contain spaces you can do something like
FOR /F "skip=4 tokens=2,*" %%A IN ('REG.exe query "HKLM\software\foo\bar" /v "baz"') DO set "MATLABROOT=%%B"
如果名称是动态的,只在运行时已知的,你将不得不使用代币= *和解析%%一个寻找REG_,让你知道数据开始的地方...
If the name is dynamic and only known at run time, you would have to use tokens=* and parse %%A looking for "REG_" so you know where the data starts...
这篇关于如何读取从批处理文件注册表字符串值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文