基本需求:使用BAT批处理对比两个文件输出不同部分实现裁剪文件的功能。
例如,客户为我们提供了一个参考文件,但是我们每次设计都会有改动的地方,为了方便找出这些地方并保存下来,设计如下。
(for /f “use back delims=” %%a in ("%comparefile%") do( findstr /I /c:"%~a" “%sourfile%” >null 2 >null && echo %%~a
))>>!targetfile!
findstr /vixg:"%comparefile%" “sourfile” >!newfile!