faqts : Computers : Software : File management

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

55 of 64 people (86%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

File: Compare: Operating system: Microsoft: Windows:MSDOS: How to compare 2 files? [fc / equal]

Nov 18th, 2003 10:02
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 18 November 2003 - 18:27 pm -------------------

File: Compare: Operating system: Microsoft: Windows:MSDOS: How to 
compare 2 files? [fc / equal]

---

Steps: Overview:

 1. -Goto MSDOS

 2. -on the command line, type the command

      fc myfirstfile mysecondfile

 3. -if the files are equal that will
     (possibly after a while) return
     to the command line showing

      'FC: no differences encountered'

---
---

To compare 2 files to check if they are
completely equal, you can use the MSDOS
command fc.exe
(to be found e.g. in
 c:\windows\system32\fc.exe
 or
 c:\windows\command\fc.exe)

---

Binary files with extensions like:

.EXE
.COM
.SYS
.OBJ
.LIB
.BIN

are compared byte for byte, otherwise,
comparison is line by line.

---

Comparing text files:


To compare text files
FILE1 and FILE2, type:

 fc myfirstfile mysecondfile        blank areas must match
                                    character for character

 fc myfirstfile mysecondfile /w     blank areas can be of
                                    different sizes

 fc myfirstfile mysecondfile /a     show only start and end
                                    text on mismatches

---

If there are mismatches in this text ASCII files this might show as:

 ***** first file
 start
  ...
  ...
 end
 ***** second file
 start
  ...
  ...
 end
 *****

---
---

Comparing binary files:

To compare program files myfirstfile.EXE and mysecondfile.EXE,
type:

 fc myfirstfile.exe mysecondfile.exe

---

If there are mismatches in this binary files this might show as:

 AAAAAAAA BB BB

where:

 A = Hex location from start of file.

and

 B = Hex characters in first and second files.

---
---

To see more information, type

 fc /?

This will show a screen similar to the following:

+---------------------------------------------------------------------+
|Compares two files or sets of files and displays the differences     |
| between them                                                        |
|                                                                     |
|                                                                     |
|FC [/A] [/C] [/L] [/LBn] [/N] [/OFF[LINE]] [/T] [/U] [/W] [/nnnn]    |
|   [drive1:][path1]filename1 [drive2:][path2]filename2               |
|FC /B [drive1:][path1]filename1 [drive2:][path2]filename2            |
|                                                                     |
|  /A         Displays only first and last lines for each set of      |
|             differences.                                            |
|  /B         Performs a binary comparison.                           |
|  /C         Disregards the case of letters.                         |
|  /L         Compares files as ASCII text.                           |
|  /LBn       Sets the maximum consecutive mismatches to the specified|
|             number of lines.                                        |
|  /N         Displays the line numbers on an ASCII comparison.       |
|  /OFF[LINE] Do not skip files with offline attribute set.           |
|  /T         Does not expand tabs to spaces.                         |
|  /U         Compare files as UNICODE text files.                    |
|  /W         Compresses white space (tabs and spaces) for comparison.|
|  /nnnn      Specifies the number of consecutive lines that must     |
|             matc h                                                  |
|             after a mismatch.                                       |
|  [drive1:][path1]filename1                                          |
|             Specifies the first file or set of files to compare.    |
|  [drive2:][path2]filename2                                          |
|             Specifies the second file or set of files to compare.   |
+---------------------------------------------------------------------+
----------------------------------------------------------------------