简体   繁体   中英

Set variables in batch file with registry values

I'm going To explain what I want because I really don't know how to get it done ... In a batch file, I want to set some variables with registry values, for example,

\hklm\software\teste
    Test1   REG_SZ   c:\teste1
    Test2   REG_SZ   c:\teste2
    .....

And in the batch file

Test1=c:\test1
Test2=c:\test2
......

Try this

for /f "tokens=1,3" %%a in ('reg query hklm\software\teste') do (
 set "%%~a=%%~b"
)

echo/%valueName%

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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