我有两个 .properties 文件如下
first.properties second.properties
----------------- ---------------------
firstname=firstvalue fourthname=fourthvalue
secondname=secondvalue sixthname=sixthvalue
thirdname=thirdvalue nineththname=ninethvalue
fourthname=fourthvalue tenthname=tenthvalue
fifthname=fifthvalue
sixthname=sixthvalue
seventhname=seventhvalue
我想比较两个文件,需要从 first.properties 中删除通用名称-值对。输出文件应为
third.properties.
------------------
firstname=firstvalue
secondname=secondvalue
thirdname=thirdvalue
fifthname=fifthvalue
seventhname=seventhvalue
我使用了以下代码,但它给出了笛卡尔产品场景。你能帮我实现上述目标吗?
for /F "tokens=1,2 delims==" %%E in (first.properties) do (
for /F "tokens=1,2 delims==" %%G in (second.properties) do (
if "%%E" NEQ "%%G" echo %%E=%%F>>!HOME!\Properties\third.properties
)
)