Computing Staff
  • 0

Search For Reg Key Containing String

  • 0

I am trying to create a bat file that will search a registry hive and return a key that contains a substring …and doesn’t contain another substring….

I need to search and find certain key names but do not have the full key name …\
is there a way to do this with REG.exe

Share

1 Answer

  1. Maybe something like this:

    for %%a in ("HKLM" "HKCU" "HKCR" "HKU" "HKCC") do (
        2>nul reg query %%a /s | find /v "    " | find /i "wanted string" | find /v /i "unwanted string"
    )
    

    Remove any unneeded hive roots to taste, or add subkeys
    to narrow the search.

    Remove /i switches to the find commands for a case sensitive search.

    • 0