我有两个 .properties 文件如下
first.properties second.properties
----------------- ---------------------
firstname=firstvalue fourthname=100100
secondname=secondvalue sixthname=200200
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
)
)