There may be many situations when we need to compare two files/folders in our PC. When we compare two files, we generally try to compare line by line. There are a lot of third party software available for comparing files. But today I will tell you how to compare two files line by line without installing any 3rd party software.
We can compare two files using command prompt by comp command. Lets discuss how to compare it exactly.
NOTE: In below examples I am comparing D:Folder1data.txt with D:Folder2data.txt
You need to enter your own file paths.
Comparing Files
Case sensitive Compare
For comparing two files when case is sensitive type the following.
In the above line /a is for showing the difference in ASCII format, you can replace it with /d for showing the difference in DECIMAL format and /l is for displaying the line numbers for differences.
Case in-sensitive Compare
For comparing two files when case is not sensitive type the following.
In the above line /c indicates case in-sensitivce search.
Specific number of lines to compare
If you want to compare only few lines of the file then you can mention it by /n
In the above line the number after /n indicates the number of lines to compare. In this case top 13 lines will be comapared and other lines will be skipped.
Comparing Folders
If you want to compare two folders then just enter path to the folders.
In the above line all the notations carries the same meaning as previous. You can also use /c for case in-sensitive comparison.