Introducing RegExport: A Tool for Live Exporting Registry Keys and Entries to .reg Files

The idea for this new utility came to me when I misinterpreted a screenshot in a tweet that showed a .reg file side by side with a Registry view.  It turned out to be about an upcoming PowerToys “reg file preview” tool (a cool idea in its own right), but I first thought it might be a Registry export tool whereby a .reg file could be built by gradually exporting selected Registry contents (individual keys or just specific entries).  For those who often deal with user profiles and/or server farms, harvesting Registry content from one user or machine for distribution to others is a frequent activity, sometimes involving multiple separate full-key exports to different .reg files followed by their tedious consolidation into a single file and removal of excess items (like unwanted subkeys or individual entries).  And so, a couple of decades too late for it to have been a real help throughout my IT career, I decided nonetheless to create such a tool.

When RegExport.exe is running and Regedit is the active window, a number of hotkeys and a pop-up menu become available to “live export” keys and entries to a pre-selected .reg file opened in a Notepad window (if no .reg file has yet been selected and opened, you will be prompted to select or create one before the export operation is performed).  Specifically:

If a key (but none of its entries) is currently selected,

  • Ctrl+Shift+E will export the entire key, including subkeys, and
  • Ctrl+Alt+E will export the key only, excluding subkeys.

If on the other hand one or more entries at the current key are selected,

  • Ctrl+Shift+E will export only those entries, and
  • Ctrl+Alt+E will do the same but also add “comments” to entries of certain types:  REG_EXPAND_SZ and REG_MULTI_SZ entries will be commented with their text representation (not normally readable in .reg files), and REG_DWORD entries greater than 9 will be commented with their decimal equivalent.  The individual items in a REG_MULTI_SZ entry are separated in comments by a block character (■).  Comment lines start with // and have no effect when a .reg file is imported.  [See the screenshot below.]

At any time following one of the above export operations (as long as the target Notepad window is still available),

  • Ctrl+Shift+U will undo the result of the operation (i.e. remove whatever was added to the Notepad window).  This is a one-level Undo only, so pressing the hotkey again is a “Redo”, putting back what was removed.  As with the other ones, this hotkey only works when Regedit is the active window.

As an alternative to the hotkeys, the pop-up menu shown in the following sample screenshot can be invoked via mouse middle-click anywhere in the Regedit window and can perform the same operations:

Notes & Other Features:

  • By default, subkeys of HKEY_USERS will be exported as their HKEY_CURRENT_USER equivalent, generally more useful for importing purposes.  This can be changed at any time by unchecking this option in RegExport’s tray icon context menu, seen below:
  • This menu also offers the ability
    • to launch Regedit (always the 64-bit version on 64-bit Windows)
    • to select or create a .reg file (and open it in Notepad, ready to receive exports – use this at any time to switch to a different .reg  export file), and
    • to (approximately) tile Regedit and the .reg file’s Notepad windows side by side on the screen (first launching either one if it’s not already running). 
    • The “Suspend hotkeys” option also disables the middle-click pop-up menu, essentially pausing the program without closing it – use this to temporarily re-enable any conflicting hotkeys meaningful to other apps.
  • In order to be able to “read” the names of the currently selected key and entries from Regedit, RegExport must be running at the same or higher “integrity level” as Regedit.  This means that, unless you’re running Regedit non-elevated, RegExport must also run “as admin”.
  • Exported items are always added to the bottom of the currently selected  .reg file, regardless of the text caret’s position in the Notepad window. 
  • RegExport never saves the .reg file as it exports items to it – you must do so yourself before closing its Notepad window (or at any time before then while you’re exporting items).
  • For maximum compatibility, RegExport is compiled as a 32-bit program, but it accesses the full 64-bit Registry view on 64-bit Windows.  Do not use 32-bit Regedit on 64-bit Windows with RegExport, or what you wind up exporting may not be what you think you’re exporting!

Nerd Notes:

  • If you’re using a laptop without a mouse and want to invoke RegExport’s middle-click pop-up menu, you may find that your touchpad/trackpad/clickpad emulates a middle-click when you perform a 3-finger click action (pushing firmly down on the pad with three fingers), not to be confused with a 3-finger tap action (a light tap on the pad with three fingers), which typically invokes Cortana! If this doesn’t work in your case, see if your particular touchpad’s configuration tool has a setting for “middle-click” and enable it if necessary.
  • The reason the “Tile Regedit & Notepad” feature is described above as “approximate” is that Windows 10/11 windows have a “secret” invisible border (usually 7 or 8 pixels wide) that API functions consider part of the window for all positioning & sizing purposes.  This leads to small but visible gaps between windows that are in fact technically adjacent.  Since the invisible border width appears to be theme-dependent and determining it isn’t well documented, I didn’t bother compensating for it in the “tiling” calculations, at least for now.

Later.
JB

Follow Jacques Bensimon on Twitter @JacqBens for more great Windows insights and tricks.

TAGS