0

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
......
2
  • Duplicate of stackoverflow.com/questions/445167/…? Commented Aug 8, 2014 at 16:45
  • To one registry value I have it already, but to run for several, that's my problem .... Commented Aug 8, 2014 at 16:49

1 Answer 1

1

Try this

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

echo/%valueName%

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your answer. That would work if the variables were in fact numerical sequence, but that was just and example, sorry. In fact the values are completely different, like, for example, name, address, telephone ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.