Error DataBase-One Place all Solutions Forums Blog Glossary    Contact Us
Search  
   
Browse by Category
Error DataBase-One Place all Solutions .: Operating Systems .: Windows Operating Systems .: MS DOS .: How to Compare the contents of two files or sets of files using FC.EXE

How to Compare the contents of two files or sets of files using FC.EXE

Compare the contents of two files or sets of files. Display any lines which do NOT match.

Syntax
      FC /B pathname1 pathname2

      FC [options] pathname1 pathname2

Key
   /B  : Perform a binary comparison.

options
   /C  : Do a case insensitive string comparison

   /A  : Displays only first and last lines for each set of differences.

   /U  : Compare files as UNICODE text files.
   /L  : Compares files as ASCII text. (default)

   /N  : Display line numbers (ASCII only)

   /LBn: Limit the number of lines that will be read, "n" sets a maximum number
         of mismatches after which the File Comparison will abort (resync failed)
         When FC aborts (resync failed) then "n" number of mismatches will be shown. 

  /nnnn  : Specify a number of consecutive lines that must match after a mismatch.
           This can be used to prevent the display of the two files from getting 
           too out of sync

  /T     : Do not expand tabs to spaces.
  /W     : Compress white space (tabs and spaces) for comparison.

To compare sets of files, use wildcards in pathname1 and pathname2 parameters.

To identify 2 identical files use this syntax:

   FC file1.txt file2.txt | FIND "FC: no dif" > nul 
   IF ERRORLEVEL 1 goto :s_files_are_different

Example:

If two files are compared and the four lines of text match as follows

1: different
2: same
3: same
4: different

Specifying /nnnn =2 the file compare will display the 4th line and continue
Specifying /nnnn =3 the file compare will halt at the 4th line (files too different)
Specifying /LB1 the file compare will halt after the first line


How helpful was this article to you?

Related Articles

article How to Automated cleanup of Temp files, Internet files, downloaded files, recycle bin using CLEANMGR.EXE Tool(XP)
Syntax CLEANMGR option Options ...

(No rating)  3-7-2008    Views: 375   
article How to VHD files with VHDMount
Virtual Server 2005 R2 SP1 includes a tool...

(No rating)  4-14-2008    Views: 200   
article How to restore Files to a Different Computer
To be able to use encrypted files on a...

(No rating)  5-21-2008    Views: 117   

User Comments

Add Comment
No comments have been posted.