WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: jtrask on February 25, 2015, 08:39:36 AM

Title: Exporting Multiple Registry Keys to a File
Post by: jtrask on February 25, 2015, 08:39:36 AM
I have a script that will prompt the user for a string and then return a text file with a list of all the keys including that string.  I've decided that a .REG file would be more useful.

I've seen examples of exporting a single key to a .REG file, or exporting a key and all of it's child objects to a file, but nothing that would export multiple individual keys to a single file.

Now I'm thinking that easiest thing to do is read the .TXT file I'm creating now and use that to build a .REG file.  Does that seem reasonable?  Is there another/easier/better way to do this that I have missed?
Title: Re: Exporting Multiple Registry Keys to a File
Post by: td on February 25, 2015, 08:54:22 AM
Have you considered using the 'Reggie' Extender's 'rRegSearch' search function? 

Title: Re: Exporting Multiple Registry Keys to a File
Post by: jtrask on February 25, 2015, 11:27:59 AM
That's what I'm using to create the .TXT now.  I realized after posting that it was silly to create a file just so I can re-read it again.

Now I'm modifying my script to format its output to create a .REG file.  Joy.

Title: Re: Exporting Multiple Registry Keys to a File
Post by: td on February 25, 2015, 12:57:29 PM
I assume you have a good reason for creating a '.reg' file instead of some other approach.  I believe the  '.reg' format would be two lines per key for your purposes.  The first line would be the key's full path in square brackets and the second line would be the value preceded by an '@='.  Admittedly, there are a few syntax rules to follow like doubling up on backslashes in strings and the like that need to be accounted for.  But it's nothing too terribly complicated.   
Title: Re: Exporting Multiple Registry Keys to a File
Post by: jtrask on February 26, 2015, 08:23:00 AM
I have a product that doesn't always install so well that the product actually works.  It also doesn't uninstall gracefully sometimes.  The vendor has supplied me with an uninstaller that is supposed to forcibly remove the product, but I'm not finding that is the case 100% of the time.  Since I've run into this scenario before, I figured I could right something that would scan the registry for a given string, and then output all of the keys/items/data with that string.  I could just use the text file and script something to remove all of those keys, but I already have a script that will take a .REG file an merge it with the registry that could be tweaked to removed the keys in the .REG file.

Title: Re: Exporting Multiple Registry Keys to a File
Post by: jtrask on February 26, 2015, 08:27:18 AM
I've got a question about the Reggie Extender.  When I search @REGMACHINE on my 64-bit system, it looks like the results are a mixture of 64-bit and 32-bit registry keys.  Am I reading this correctly?  If so, how can I sort this all out?
Title: Re: Exporting Multiple Registry Keys to a File
Post by: td on February 26, 2015, 09:12:58 AM
Make sure you are using the latest version of the extender and then check out the rRegView function in the extender's help file.  The function controls the view (32-bit view or 64-bit view) that is searched.
Title: Re: Exporting Multiple Registry Keys to a File
Post by: td on February 26, 2015, 09:25:21 AM
Should also mention that if you use the 64-bit view, the keys under Wow6432Node will be searched and returned.  These are the 32-bit view keys with the Wow6432Node subkey included.
Title: Re: Exporting Multiple Registry Keys to a File
Post by: jtrask on February 26, 2015, 10:45:42 AM
Thank you, thank you, thank you.  That's so much more efficient that checking each both views for a few hundred registry keys!