How to compare two files with Command Prompt on Windows 10 (2024)

How to compare two files with Command Prompt on Windows 10 (1)

On Windows 10, "fc" is a command-line tool that comes built-in to the system, and it allows you to compare two similar files to determine how they changed over time. Usually, fc will be helpful for comparing simple text files, determining the changes made to a script, detecting if a file has been modified, and similar scenarios.

The tool can compare two similar files or the newest version against all the other files in the same location. And it includes options to examine the changes at the text level, or in Unicode, ASCII, or binary mode.

In this Windows 10 guide, you will learn steps to use the fc tool to compare files with Command Prompt.

How to compare files with the fc command on Windows 10

To compare files with the fc command tool, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to browse to the folder with the files you want to compare and press Enter:cd PATH\TO\FILESIn the command, update the path with the location of the folder with the files to compare.This example navigates to the Downloads folder:cd C:\Users\USERACCOUNT\Downloads
  4. Type the following command to compare two similar files and press Enter:fc filename1.txt filename2.txtIn the command, replace filename1.txt and filename2.txt for the name of the files you want to compare.
  1. Type the following command to compare two similar files in ASCII mode and press Enter:fc /L filename1.txt filename2.txt
  2. Type the following command to compare two files displaying only the first line that is different and press Enter:fc /a filename1.txt filename2.txt

How to compare two files with Command Prompt on Windows 10 (3)

  1. Type the following command to compare two files in Unicode mdoe and press Enter:fc /u filename1.txt filename2.txt

How to compare two files with Command Prompt on Windows 10 (4)

  1. Type the following command to compare two files in baniry mode and press Enter:fc /b filename1.txt filename2.txt

How to compare two files with Command Prompt on Windows 10 (5)

  1. Type the following command to compare all the files (*.txt) in the same folder to the new file (filename2.txt) and press Enter:fc *.txt filename2.txt

How to compare two files with Command Prompt on Windows 10 (6)

  1. Type the following command to compare two files in different locations and press Enter:fc DRIVE:\PATH\TO\filename1.txt DRIVE:\PATH\TO\filename2.txtIn the command, replace DRIVE for the storage location drive letter and \PATH\TO\filename1.txt and \PATH\TO\filename2.txt with the path and name of the files you want to compare.This example compares two files in different folders:fc C:\Users\USERACCOUNT\Downloads\filename1.txt C:\Users\USERACCOUNT\Downloads\new\filename2.txt

How to compare two files with Command Prompt on Windows 10 (7)

  1. Confirm the output to see the difference between the files.Quick tip: You can view the list of options and more examples using the fc /? command.

Once you complete the steps, you will be able to see the difference between two similar files.

While the tool allows you to compare files, remember that this is a basic tool meant to use it with text files and extensions like .exe, .com, .sys, .obj, .lib, or .bin. You may be able to compare files like those from Microsoft Office or images, but you can only compare them at the binary level.

More Windows 10 resources

For more helpful articles, coverage, and answers to common questions about Windows 10, visit the following resources:

Get the Windows Central Newsletter

All the latest news, reviews, and guides for Windows and Xbox diehards.

Mauro Huculak has been a Windows How-To Expert contributor for WindowsCentral.com for nearly a decade and has over 15 years of experience writing comprehensive guides. He also has an IT background and has achieved different professional certifications from Microsoft, Cisco, VMware, and CompTIA. He has been recognized as a Microsoft MVP for many years.

How to compare two files with Command Prompt on Windows 10 (2024)

FAQs

How to compare two files with Command Prompt on Windows 10? ›

Open Start. Search for Command Prompt, right-click the top result, and select the Run as administrator option. Type the following command to compare two similar files and press Enter: fc

fc
In computing, fc (File Compare) is a command-line program in DOS, IBM OS/2 and Microsoft Windows operating systems, that compares multiple files and outputs the differences between them. It is similar to the Unix commands comm , cmp and diff .
https://en.wikipedia.org › wiki › File_Compare
filename1. txt filename2.

How to compare two files using cmd? ›

Comparing files (diff command)
  1. To compare two files, type the following: diff chap1.bak chap1. This displays the differences between the chap1. ...
  2. To compare two files while ignoring differences in the amount of white space, type the following: diff -w prog.c.bak prog.c.

Does Windows 10 have a file comparison tool? ›

To compare files in Windows 10, launch File Explorer and select the two folders you wish to compare. Then, right-click on the folder, select “Compare” from the context menu. A window will appear showing the differences between the contents of the two folders.

How to find the difference between two files? ›

Use the diff checker to compare code files for debugging or compare creative text files to ensure you avoid plagiarism or duplicate content. A text diff tool automatically highlights any detected text difference, making fixing any errors in your text documents much easier.

How to compare two folders in Windows 10 cmd? ›

One way to compare folders is to right-click your folders one at a time and choose "Properties" for each. Then compare the Properties window of each folder. The robocopy command is a command-line tool that can be used to view the differences between folder.

Which of the following command is used to compare two files? ›

Which command is used to display the differences between files? Explanation: diff command is used for comparing files and displaying the differences between them.

Which command compares two files and indicates if they are different? ›

The Linux diff command compares two files line by line and displays the differences. This command-line utility lists changes you must apply to make the files identical.

How to use comp command in cmd? ›

If you enter the COMP command with no options , the program will prompt you for the file and/or path designations. After you enter the second filename(s), the program will compare the files, issuing reports on its progress. If the files are not identical, it will report on the differences it finds.

How do I compare two documents in Windows? ›

Compare two versions of a document
  1. Open one of the two versions of the document that you want to compare.
  2. On the Review menu, select Compare Documents.
  3. In the Original document list, select the original document.
  4. In the Revised document list, browse to the other version of the document, and then select OK.

Is Windiff available in Windows 10? ›

It works in Windows 10 but you might find problems from time to time. Whichever source you get it from, it is a very old tool that is no longer developed or supported.

How do I compare two file systems in Windows? ›

To compare two files or groups of files at a local site, you can use the Fc.exe and the Comp.exe file compare commands. Both commands are run from a command prompt. You can use Fc.exe to compare two ASCII or binary files on a line-by-line basis. It offers several command-line options.

Is there a program to compare two files? ›

WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.

How to use FC in CMD? ›

FC
  1. Type: External (3.3 and later)
  2. Syntax: FC [d:][path]filename [d:][path]filename [/A][/C][/L][/Lb n] [/N][/T][/W] ...
  3. Purpose: Displays the differences between two files or sets of files.
  4. Discussion. FC reports differences between the two files you specify. ...
  5. Options. ...
  6. Example.

How to compare two files in cmd? ›

Compare two files (command-line)

From the Developer Command Prompt, use the /Diff ( -diff ) option.

How to check if two files are identical? ›

Hash comparison is a popular and fast method to check if two files have same content. A hash function takes a file and generates a fixed-size string, known as a hash value, that represents content of file. If two files have same hash value, it is almost certain that they have same content.

How to use cmp command in Windows? ›

Examples
  1. To determine whether two files are identical, enter: cmp prog.o.bak prog.o This compares prog.o.bak and prog.o . ...
  2. To display each pair of bytes that differ, enter: cmp -l prog.o.bak prog.o. ...
  3. To compare two files without writing any messages, enter: cmp -s prog.c.bak prog.c.

What is the CMP command to compare two files? ›

When 'cmp' is used for comparison between two files, it reports the location of the first mismatch to the screen if a difference is found and if no difference is found i.e. the files compared are identical. 'cmp' displays no message and simply returns the prompt if the files compared are identical.

Does Notepad++ have a diff tool? ›

If you only want to view the lines that are different, you can use Plugins > ComparePlus > Show Only Diffs (or the ShowOnlyDiffs button next to the “Last” button on the toolbar), but unfortunately, even if it only shows the differing lines, it will still copy all the lines (even the hidden ones) with a Ctrl+A, Ctrl+C .

How to check if two files have the same content? ›

Fastest Method to Check If Two Files Have Same Contents
  1. Method 1: File Size Comparison. One of simplest and fastest ways to check if two files have same contents is to compare their file sizes. ...
  2. Method 2: Hash Comparison. ...
  3. Method 3: Binary Comparison. ...
  4. Additional Methods.
Mar 23, 2023

Top Articles
Latest Posts
Article information

Author: Lidia Grady

Last Updated:

Views: 6064

Rating: 4.4 / 5 (45 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Lidia Grady

Birthday: 1992-01-22

Address: Suite 493 356 Dale Fall, New Wanda, RI 52485

Phone: +29914464387516

Job: Customer Engineer

Hobby: Cryptography, Writing, Dowsing, Stand-up comedy, Calligraphy, Web surfing, Ghost hunting

Introduction: My name is Lidia Grady, I am a thankful, fine, glamorous, lucky, lively, pleasant, shiny person who loves writing and wants to share my knowledge and understanding with you.