Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Windows equivalent of the diff command?

Tags:

windows

diff

cmd

I know that there is a post similar to this : here.
I tried using the comp command like it mentioned, but if I have two files, one with data like "abcd" and the other with data "abcde", it just says the files are of different sizes. I wanted to know where exactly they differ. In Unix, the simple diff tells me which row and column, the comp command in windows works if I have something like "abd" and "abc". Not otherwise. Any ideas what I can use for this?

like image 954
wittythotha Avatar asked Jul 29 '11 18:07

wittythotha


People also ask

Does Windows have a diff command?

You can use the diff command to show differences between two files, or each corresponding file in two directories. diff outputs differences between files line by line in any of several formats, selectable by command line options. This set of differences is often called a `diff' or `patch'.

What is the equivalent command in Windows?

The where command is a Windows which equivalent in a command-line prompt (CMD). In a Windows PowerShell the alternative for the which command is the Get-Command utility.

How do I compare two Windows command prompt?

The fc (file compare) command is used to compare two files. Once fc is run and completed, it returns lines that differ between the two files. If no lines differ, you will receive a message indicating such.


2 Answers

Run this in the CMD shell or batch file:

FC file1 file2 

FC can also be used to compare binary files:

FC /B file1 file2 
like image 62
Andriy M Avatar answered Sep 21 '22 19:09

Andriy M


Well, on Windows I happily run diff and many other of the GNU tools. You can do it with cygwin, but I personally prefer GnuWin32 because it is a much lighter installation experience.

So, my answer is that the Windows equivalent of diff, is none other than diff itself!

like image 37
David Heffernan Avatar answered Sep 18 '22 19:09

David Heffernan