Your Set statement in the For loop is trying to set %_Q% instead of _Q
Code:
For /F "Tokens=2*" %%a In ('Reg query "HKLM\Software\MyCo" /v Data') Do set _Q=%%b
I use this to get data from a single reg query:
Code:
For /F "Tokens=3 skip=2" %%a In ('Reg query "HKLM\Software\MyCo" /v Data') Do set _Q=%%a
This skips the 1st two lines that reg query outputs, then directly accesses the 3rd item, which will be the value.
Jerry