I'm wondering is there any option via command line to search for a string and export all found keys in Windows registry?
Asked
Active
Viewed 2.4k times
3 Answers
12
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.

Abhineet
- 5,320
- 1
- 25
- 43
-
1How does this "search for a string" as was asked in the question? – StayOnTarget Aug 22 '17 at 11:24
-
@DaveInCaz - And what string are you exactly talking about? – Abhineet Aug 23 '17 at 05:08
-
1the question says "I'm wondering is there any option via command line to search for a string" – StayOnTarget Aug 23 '17 at 10:08
-
@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 ` – Abhineet Aug 24 '17 at 09:12
-
2granted 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. – StayOnTarget Aug 24 '17 at 11:30
-
@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. – Abhineet Aug 28 '17 at 04:17
6
Powershell has registry iteration capabilities. Start here: http://technet.microsoft.com/en-us/library/ee176841.aspx

durilka
- 1,399
- 1
- 10
- 22
-
2Thanks @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"}` – Ara Mar 14 '13 at 15:23
2
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)

T.Todua
- 53,146
- 19
- 236
- 237