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?
相关问题
- Inheritance impossible in Windows Runtime Componen
- how to get running process information in java?
- Is TWebBrowser dependant on IE version?
- How can I have a python script safely exit itself?
- I want to trace logs using a Macro multi parameter
相关文章
- 在vscode如何用code runner打开独立的控制台窗口,以及设置好调试模式时窗口的编码?
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Bundling the Windows Mono runtime with an applicat
- Windows 8.1 How to fix this obsolete code?
- CosmosDB emulator can't start since port is al
- How to print to stdout from Python script with .py
Run this in the CMD shell or batch file:
FC
can also be used to compare binary files: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 thandiff
itself!I've found a lightweight graphical software for windows that seems to be useful in lack of
diff
command. It could solve all of my problems.WinDiff http://www.grigsoft.com/download-windiff.htm
Another alternative is to download and install git from here. Then, add the path to
Git\bin\
to yourPATH
variable. This will give you not only diff, but also many other linux commands that you can use from the windows command line.You can set the
PATH
variable by right clicking on Computer and selecting Properties. Then you can click on Advanced System Settings on the left side of the screen. In the pop up, click Environment Variables and then either add or update the PATH variable in your user variables withGit\bin\
Git diff documentation
The reason you getting the error with COMP is that the utility assumes the files that you are comparing are of the same size. To overcome that you can use th
'/n'
option with which you can specify the number of lines you want to compare. (see the options supported by comp by typing'comp /?'
on the command line. so your command would look like :This should solve your problem if you wanna stick to using COMP. But this will be a problem for really large files.
Though
comp
is an option, but I feel it is primitive andFC
is a better option. you can useFORFILES
andFC
together to probably make a really good filecompare utility if you require one on a frequent basis.FC is used this way for ref:
there are many options available which you can see by
'fc /?'
hope this helpsThe windows equivalent to the diff command is the fc (File Comapre) command.
Here are the basic steps to do so:
1. Keep the two files in a folder (Example file1.html and file2.html)
2. Launch command prompt
3. Type fc file1Location file2Location
Have found a detailed tutorial on the same:
http://www.howtogeek.com/206123/how-to-use-fc-file-compare-from-the-windows-command-prompt/