• We hope you have a fantastic holiday season to close out 2025! Thank you all so much for being part of the Tom's Guide community!

BAT Script to look for the file content in an another file and to delete if any same content exists in both files

Ragazzz88

Commendable
Aug 22, 2016
1
0
1,510
Say, I am having two text files File1 and File2.

File1 content :

Apple

Banana

Grapes

File2 content :

Orange

Apple

Pineapple

Watermelon

Banana

I am in need of deleting the matching ones in the File1.

Could anyone send me the BATCH script for the above instance..
 
I doubt this can be done (easily) with BATch (even shell) script..., this calls for well-thought application. Text files are not the easiest ones to insert into / delete lines from.