批處理指令碼 - 比較登錄檔項



透過 REG COMPARE 命令完成登錄檔項比較。

語法

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

其中 輸出 − /od(僅差異)/os(僅匹配)/oa(全部)/on(無輸出)。

示例

@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.

如果任一登錄檔項中的值存在差異,則將在輸出中顯示差異,如下面的結果所示。以下輸出顯示在登錄檔項“HKEY_CURRENT_USER\Console”中存在額外的值“EnableColorSelection”。

< Value: HKEY_CURRENT_USER\Console EnableColorSelection REG_DWORD 0x0
Result Compared: Different
The operation completed successfully.
batch_script_registry.htm
廣告
© . All rights reserved.