你经常处理.reg文件吗?虽然注册表编辑器是更改计算机设置和应用所有这些花哨修复的终极场所。Reg文件也不少;它们可以从注册表编辑器中导出,然后可以再次合并到Windows 注册表(Windows Registry)中。它们使导出或备份注册表或部分注册表成为可能。我们在这篇文章中讨论的工具称为 Regdiff,它是一个很棒的工具,可以让您以多种方式比较、排序、合并和管理您的 reg 文件。
(Compare)使用Regdiff(Regdiff)比较或合并注册表(Merge Registry)文件
比较
该工具是免费的、开源的并且易于使用。您可以将其作为可执行文件下载 - 或分叉整个源代码,以便将其合并到现有项目中。该工具的主要特点是它可以让您比较两个 reg 文件。就像代码差异一样,该工具将接收两个注册表文件并进行比较。
但是您一定想知道它与任何其他代码差异计算器有何不同?不同之处在于,Regdiff首先读取这两个文件,然后它们在逻辑级别而不是逐行比较它们。因此,即使您的两个文件具有相同内容的不同顺序,Regdiff也不会在差异中显示它。
该工具没有GUI,完全从命令行运行。要比较两个文件,您只需将 reg 文件和Regdiff都复制到一个文件夹中。现在打开一个提升的CMD窗口并执行以下命令来比较两个文件:
regdiff.exe first_file_name.reg second_file_name.reg
该工具将首先读取和解析这两个文件,然后比较并显示结果给您。即使对于完整的注册表备份,它也能快速运行。显示差异后,您可以轻松找出更改了哪些设置。或者自上次备份以来对注册表所做的总体更改是什么?
您还可以使用相同的命令直接将当前的Windows 注册表(Windows Registry)与 reg 文件进行比较。您可以提供注册表文件夹的相对地址,而不是文件名。
regdiff.exe HKEY_LOCAL_MACHINE\SOFTWARE hklm_software.reg
合并
除此之外,Regdiff支持很多选项。其中最重要的是合并(Merge )选项。您可以使用此命令合并两个注册表文件或将现有注册表合并到一个文件等等。合并命令的几个例子是:
合并两个 reg 文件:(Merge two reg files:)
regdiff.exe HKEY_LOCAL_MACHINE\SOFTWARE hklm_software.reg /merge merged.reg
导出现有注册表:(Export existing registry:)
regdiff.exe HKEY_LOCAL_MACHINE\SOFTWARE /merge hklm_software.reg
从现有的 reg 文件创建一个排序的 reg 文件:(Create a sorted reg file from existing reg file:)
regdiff.exe example.reg /merge sorted_example.reg
没有空键
可以使用的另一个最重要的选项是no-empty-keys。这将通过完全删除根本不需要的空键来帮助您整理 reg 文件。只需(Simply)在任何命令之前添加/no-empty-keys
注册表选项
/ /registry 选项可让您与本地计算机上的当前注册表值进行比较或合并。使用此选项实际上消除了使用注册表编辑器(Registry Editor)中的导出选项来创建 reg 文件的需要。现在您可以直接从注册表中获取值。
还有很多其他选项可用,每个选项都可以做某事或其他。您可以在该工具的下载页面(download page)(download page)上阅读有关所有这些选项的更多信息。提供了有关这些选项及其可用性的完整文档。
(Regdiff)如果您经常处理注册表文件,Regdiff是一个很棒的工具。少数用户可能面临的唯一问题是没有GUI。该工具完全从命令行运行,并且还在终端窗口本身中显示输出。除此之外,这是比较、合并 reg 文件并做更多事情的完美工具。
How to Compare or Merge Registry files on Windows 11/10 using Regdiff
Do yоu deal with .reg files a lot? While registry editor is the ultimate place to change your computer’s settings and apply all those fancy fixes. Reg files are also no less; they can be exported from the registry editor and later can be merged again into Windows Registry. They make it possible to export or backup registry or parts of the registry. The tool that we are talking about in this post is called Regdiff, and it is a great tool that lets you compare, sort, merge and manage your reg files in a lot of ways.
Compare or Merge Registry files using Regdiff
Compare
The tool is free, open source and easily available. You can download it as an executable – or fork the entire source code so that you can incorporate it into your existing project. The main feature of the tool is that it lets you compare two reg files. Like a code diff, the tool would take in two registry files and compare them.
But you must wonder how it is different from any other code diff calculator? The difference is, Regdiff first reads both the files and them compares them at a logical level and not line by line. So even if both your files have a different ordering of same content, Regdiff will not show it in the diff.
The tool does not have a GUI and completely runs from the command line. To compare two files all you need to do is copy both the reg files and Regdiff inside one folder. Now open an elevated CMD window and execute the following command to compare both the files:
regdiff.exe first_file_name.reg second_file_name.reg
The tool will first read and parse both the files and then compare and display the results to you. It works fast even for complete registry backups. Once the diff is displayed, you can easily find out what setting has changed. Or what were the overall changes made to the registry since your last backup?
You can also directly compare the current Windows Registry with a reg file by using the same command. Where instead of a filename, you can give the relative address of the registry folder.
regdiff.exe HKEY_LOCAL_MACHINE\SOFTWARE hklm_software.reg
Merge
Other than that, Regdiff supports plenty of options. The most important of them is the Merge option. You can use this command to merge two registry files or merge existing registry to a file and a lot more. Few examples of merge command are:
Merge two reg files:
regdiff.exe HKEY_LOCAL_MACHINE\SOFTWARE hklm_software.reg /merge merged.reg
Export existing registry:
regdiff.exe HKEY_LOCAL_MACHINE\SOFTWARE /merge hklm_software.reg
Create a sorted reg file from existing reg file:
regdiff.exe example.reg /merge sorted_example.reg
No Empty Keys
The other most important option that can be used is no-empty-keys. This would help you declutter your reg files by completely removing empty keys which are not required at all. Simply add /no-empty-keys before any command to remove all empty keys encountered.
Registry Option
The /registry option will let you compare or merge with the current registry values on the local machine. Using this option would practically eliminate the need to use the export option from Registry Editor to create reg files. As now you can directly fetch values from the registry.
There are a lot of other options available, each capable of doing something or the other. You can read more about all these options on the tool’s download page. The complete documentation is available regarding these options and their usability.
Regdiff is a great tool if you deal with registry files a lot. The only problem a few users might face is that there is no GUI. The tool runs entirely from the command line and also shows output in the terminal window itself. Other than that, this is the perfect tool to compare, merge and do a lot more with reg files.