How to Compare Content between 2 Files using Windows Command Prompt

In Windows Command Prompt, you can use fc command to compare content of 2 files. You would find this command very useful in your day to day works as no more manual comparison is required.

Launch the Windows Command Prompt, and execute the fc command. Refer below example.

There are 2 files,

  • FILE_ABC.txt
Transaction code SXMB_MONI is used to monitor the processing of XML messages, 
as well as to track message errors and statutes. 

  • FILE_DEF.txt
Transaction code SXMB_MONI is used to monitor the processing of XML messages, 
as well as to track message errors and statutes. 

Both files are having the same content, when we execute below command, the output says no differences encountered.

## COMMAND ##
fc [PATH-to-FILE] [PATH-to-FILE]
fc FILE_ABC.txt FILE_DEF.txt

## OUTPUT ##
Comparing files FILE_ABC.txt and FILE_DEF.TXT
FC: no differences encountered

We change the FILE_DEF.txt content and below is the output, which the command detect the differences.

## COMMAND ##
fc FILE_ABC.txt FILE_DEF.txt
## OUTPUT ##
Comparing files FILE_ABC.txt and FILE_DEF.TXT
***** FILE_ABC.txt
Transaction code SXMB_MONI is used to monitor the processing of XML messages, 
as well as to track message errors and statutes.

***** FILE_DEF.TXT
Transaction code ITSITI is used to monitor the processing of XML messages, 
as well as to track message errors and statutes.
*****

Note: You can also perform the comparison for any other file type like XML.

You May Also Like

Leave a Reply?