My object is to export the Windows registry in txt format using a batch file.
If I use either of the following two lines from a batch file:
REG EXPORT C:\t.txt "HKEY_CURRENT_USER\Software"
REGEDIT /E C:\t.txt "HKEY_CURRENT_USER\Software"
I get output similar to this:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software]
[HKEY_CURRENT_USER\Software\Adobe]
I am surprised with the output of export using the REGEDIT GUI. If I select File->Export and change the "Save as type" to "Text Files", I get output similar to this:
Key Name: HKEY_CURRENT_USER\Software
Class Name: <NO CLASS>
Last Write Time: 1/5/2011 - 8:27 AM
Key Name: HKEY_CURRENT_USER\Software\Adobe
Class Name: <NO CLASS>
Last Write Time: 11/4/2010 - 12:01 PM
I think the second example shows the data in a more readable format. I want to achieve the same output using cmd or batch file.
Any help will be highly appreciated.
In Registry Editor, locate and click the registry key or subkey that you want to back up. Select File > Export. In the Export Registry File dialog box, select the location to which you want to save the backup copy, and then type a name for the backup file in the File name field. Select Save.
Just use the File menu while in Notepad and use the Save As... function and rename the file with a . reg extension.
REG files are text files: Create them within a text editor when you save a file with the . reg extension. On Windows, right-click a REG file and open it with Notepad, or the text editor of your choice, to edit it. To use a REG file, simply open it and its contents will be added to the Windows Registry.
Try it like this
START /W REGEDIT /E file.txt %REG_PATH%
By default it saves files with the .reg file extension. But it's a text file which can be executed by regedit and make changes in registry.
If you think this is not readable enough, try Import/Export registry sections as XML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With