1.

Solve : Reg Query for Key Name; grab the key name to use as variable?

Answer»

Hello -

I'm trying to get the key NAME from the RESULT of a reg query command.

So I run the following:
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s /f "EMC Avamar for Windows"

The RESULTS of the command:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C87FD1C7-F6B1-41EF-82B3-3E2165E161C7}
DisplayName REG_SZ EMC Avamar for Windows

This is what I want to grab from the results and set as a variable:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C87FD1C7-F6B1-41EF-82B3-3E2165E161C7}

How COULD I accomplish this?This should work.

Code: [Select]@echo off
for /f "delims=" %%a in (' reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s /f "EMC Avamar for Windows" ^|FIND "{" ') do set "var=%%a"
echo "%var%"
two thumbs up to foxidrive! Works to perfection...thank you!



Discussion

No Comment Found