我可以使用 Perl 将 .reg 文件与 Windows 注册表进行比较吗?如果是,我该如何执行?我搜索了几个网站,但无法得到正确的回应。您的帮助将不胜感激。谢谢。
2 回答
检查Win32::TieRegistry模块。
If you're using ActiveState's ActivePerl, it will include a lot of the Windows packages that you need for things like registry reading, etc.
I recommend looking at 1 Win32:Registry
Win32::TieRegistry
. You can look at a key in our .reg
file (it's a text file), and then open that same key in the registry and compare the values. Take a look at the documentation.
Also, I believe registry files are in Windows INI file format. If that's the case, take a look at Config::IniFiles. This will help you read in your .reg
file and go through it line by line. I've used it, and it's pretty simple to use. Config::IniFiles
isn't a standard Perl module, so you have to download it from CPAN. However, ActivePerl comes with Config::Ini. I haven't used that one, but it looks like it might help.
1 I've been informed by Dmitry Mina that Win32::Registry
is obsolete. I now see it says so in the documentation and the documentation recommends to use Win32::TieRegistry
.