Improved REG & INI File Sort Utility


On the heels of the recent post describing the new RegExport utility, the output of which is always in the “Windows Registry Editor Version 5.00” Unicode format, it became clear that my old RegSort v1.x tool (described here) had become obsolete since it was limited to only sorting .reg files in the “REGEDIT4” ANSI format (and ANSI INI files).  The v2.x update described below eliminates this limitation and improves significantly on the original.

To summarize again the purpose of RegSort, it is to create sorted versions of files in REG or INI formats to ease comparisons:  keys in RegSort’s output files appear in alphanumeric order and the entries under each key are also listed in alphanumeric order.  This new version improves on the original in the following ways:

  • As already mentioned, RegSort is no longer limited to processing files in ANSI format:  it now recognizes each input file’s encoding and generates an output file of the same type.  Files not recognized as valid Registry export files (based on header and encoding) are treated as INI-format files.  This information is part of RegSort’s syntax summary, obtained by running the utility without a parameter:
  • Long binary entries that are split over multiple lines in REG-format files are no longer collapsed into a single long line in RegSort’s output as they were in v1.x.
  • This new version uses a completely revamped sorting mechanism and can now process very large input files (artificially limited to a little under 1GB Unicode, 512MB ANSI) dramatically faster than the original.  For a sense of scale, a full HKEY_LOCAL_MACHINE Unicode-format export from a typical machine would fall in the 200-300MB range and would typically be processed in 2-3 minutes (versus possibly a couple of hours previously!)
  • As an additional efficiency measure, RegExport’s progress indicator shows basic “milestones” through the current file but no longer displays the key currently being processed, as shown below.  The progress bar is however accurately updated (and advances much faster than previously! 😉)

A few items remain true in this version:

  • Input files are not limited to .reg or .ini extensions, only the file contents matter.  The output from a file named HKLM.rek would for example be named HKLM_Sorted.rek.
  • “Comment” lines added to an input REG or INI file (regardless of the syntax used to denote comments) will not maintain their position relative to the line(s) that follow them in the input file.  They will appear in the output file sorted along with the entries belonging to the preceding key, and comments that precede the first key in the input file will disappear entirely from the output.  This affects neither the ability to import a sorted REG file nor the ease of comparing two sorted REG or INI files.

Happy sorting!

JB

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

TAGS