What is the Windows equivalent of the diff command

2020-01-25 12:20发布

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?

标签: windows cmd diff
13条回答
来,给爷笑一个
2楼-- · 2020-01-25 12:44

I don't know if the following tool is exatly what you need. But I like to use, for specific files, some online tool. This way I can use it regardless of the operational system. Here is a example: diffchecker.com

But for my needs, I guess the best tool to track changes and logs of my project's files is GIT. If you work in a team, you can have some repo online in a server of yours, or use it with Bitbucket or Github.

Hope it helps somebody.

查看更多
Root(大扎)
3楼-- · 2020-01-25 12:46

fc. fc is better at handling large files (> 4 GBytes) than Cygwin's diff.

查看更多
虎瘦雄心在
4楼-- · 2020-01-25 12:47

There's also Powershell (which is part of Windows). It ain't quick but it's flexible, here's the basic command. People have written various cmdlets and scripts for it if you need better formatting.

PS C:\Users\Troll> Compare-Object (gc $file1) (gc $file2)

Not part of Windows, but if you are a developer with Visual Studio, it comes with WinDiff (graphical)

But my personal favorite is BeyondCompare, which costs $30.

查看更多
叛逆
5楼-- · 2020-01-25 12:49

If you have installed git on your machine, you can open a git terminal and just use the Linux diff command as normal.

查看更多
Emotional °昔
6楼-- · 2020-01-25 12:50

Winmerge has a command line utility that might be worth checking out.

Also, you can use the graphical part of it too depending on what you need.

查看更多
beautiful°
7楼-- · 2020-01-25 12:51

DiffUtils is probably your best bet. It's the Windows equivalent of diff.

To my knowledge there are no built-in equivalents.

查看更多
登录 后发表回答