I'm wondering is there any option via command line to search for a string and export all found keys in Windows registry?
Regedit: Find and export keys from command prompt
Powershell has registry iteration capabilities. Start here: http://technet.microsoft.com/en-us/library/ee176841.aspx
Ex:: If you want to check whether "HKLM\software\etc" key exists.
reg.exe query "HKLM\Software\etc"
will return all the subkeys and values in command prompt if found or an error if not found.
ALso, you can directly do
reg.exe export "HKLM\software\etc" "C:\etc.reg"
This will export the registry key and subkeys if found otherwise error if not found.
How does this "search for a string" as was asked in the question? –
Bogy
@DaveInCaz - And what string are you exactly talking about? –
Szechwan
the question says "I'm wondering is there any option via command line to search for a string" –
Bogy
@DaveInCaz - I am not able to understand your doubt. By string, the OP is referencing to keys and subkeys, not the data or value of the keys, if that is your doubt. For your reference::
search for a string and export all found keys
–
Szechwan granted he did not specify an example, unfortunately, but I understood "search" to mean something more powerful. for instance, to discover all keys containing a specific string. Not necessarily an exact key name or subset of known keys. –
Bogy
@DaveInCaz - Yeah, that is one possibility and I think, that's why this answer is not the accepted one. I answered as I understood the question. –
Szechwan
Powershell has registry iteration capabilities. Start here: http://technet.microsoft.com/en-us/library/ee176841.aspx
Thanks @durilka. I was able to solve this problem using powershell command
Get-ChildItem -recurse Registry::HKEY_CLASSES_ROOT\CLSID | ForEach-Object {Get-ItemProperty $_.pspath} | where {$_ -match "string to find"}
–
Avra export key (with all sub-keys), from CMD (or RUN) i.e.:
regedit /e c:\output.reg "HKEY_LOCAL_MACHINE\System\YourLocation"
p.s. you should run this in CMD with ADMIN PRIVILEGES. for that, right click on START>Run CMD (as Admin)
It doesn't work with Wow64. It always export keys from Wow6432Node. –
Sext
© 2022 - 2025 — McMap. All rights reserved.
Get-ChildItem -recurse Registry::HKEY_CLASSES_ROOT\CLSID | ForEach-Object {Get-ItemProperty $_.pspath} | where {$_ -match "string to find"}
– Avra