I want to get the output of the command below assigned to a variable.
reg query "HKLM\SYSTEM\CurrentControlSet\Enum\USB\VID_05E3&PID_0608\
If I run it from the Command Prompt, I get
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_05E3&PID_0608\5&1d69168d&0&3
which is what I need to use for a reg add, so, I am trying to assign it to a variable.
For testing, I wrote this batch script:
FOR /F "delims=" %%g IN ('reg query "HKLM\SYSTEM\CurrentControlSet\Enum\USB\VID_05E3&PID_0608\') do (SET RegPath=%%g)
echo %RegPath%
pause
But, the only output I get is the current directory - C:\Users\myname\etc.
My final goal is something like this:
FOR /F "delims=" %%g IN ('reg query "HKLM\SYSTEM\CurrentControlSet\Enum\USB\VID_05E3&PID_0608\') do (SET RegPath=%%g)
reg add %RegPath%\Device Parameters /v EnhancedPowerManagementEnabled /t REG_DWORD /d 0 /f
I know this should be simple, what am I missing?