无涯教程-批处理 - Comparing Registry Keys函数

66 阅读1分钟

比较注册表项是通过REG COMPARE命令完成的。

REG COMPARE [ROOT\]RegKey [ROOT\]RegKey [/v ValueName] [Output] [/s]
REG COMPARE [ROOT\]RegKey [ROOT\]RegKey [/ve] [Output] [/s]

Output - /od (only differences) /os (only matches) /oa (all) /on (no output).

@echo off
REG COMPARE HKEY_CURRENT_USER\Console HKEY_CURRENT_USER\Console\Test

上面的程序将比较注册表项之间的所有值  HKEY_CURRENT_USER\Console & HKEY_CURRENT_USER\Console\Test.

Result Compared: Identical
The operation completed successfully.

如果两个注册表项中的两个值之间存在差异,则它将显示在输出中,如以下输出所示。

< Value: HKEY_CURRENT_USER\Console EnableColorSelection REG_DWORD 0x0
Result Compared: Different
The operation completed successfully.

参考链接

www.learnfk.com/batch-scrip…