I need to extract certain data from a registry key and output this data to separate files so that I can call another external program to perform functions on the output. I want to do this for all of the registry keys under HKLM\System\ControlSet001\Enum\USBSTOR(Unknown Name)(serial number) I then need it to extract the Friendly Name value.
I need it to do this one key at a time and then send the Serial number and friendly name to separate .txt files for each key so the final output looks something like -
001E0BB89D74BF4160004514&0 Kingston DT4000 G2 USB Device (stored in 1.txt)
50E549C6952EB1A00000002E&0Next Kingston DataTraveler 2.0 USB Device (2.txt)
At the moment I am using -
Reg query HKLM\System\ControlSet001\Enum\USBSTOR /s /v FriendlyName>>%~dp0Report.txt
This lists all the keys as -
HKEY_LOCAL_MACHINE\System\ControlSet001\Enum\USBSTOR\Disk&Ven_Kingston&Prod_DataTraveler_2.0&Rev_1100\50E549C6952EB1A00000002E&0 FriendlyName REG_SZ Kingston DataTraveler 2.0 USB Device
HKEY_LOCAL_MACHINE\System\ControlSet001\Enum\USBSTOR\Disk&Ven_Kingston&Prod_DT4000_G2&Rev_PMAP\001E0BB89D74BF4160004514&0 FriendlyName REG_SZ Kingston DT4000 G2 USB Device
Ive tried a for /f loop and researched elsewhere but no matter what I try I cant get it to work.
Any suggestions greatly appreciated.