简体   繁体   中英

How can i find the difference between two files in cmd

I am trying to compare two files and get the output in another text file. So far I have checked and found only solutions to Unix or other OS, but I am looking for a Windows 10 solution.

These are what I have looked at so far:

Find the difference between two files

How to find difference between two text files in different directories in ubuntu os through command-line

https://www.howtogeek.com/206123/how-to-use-fc-file-compare-from-the-windows-command-prompt/

https://www.softwaretestinghelp.com/compare-two-files-unix/

https://superuser.com/questions/805522/compare-two-files-and-output-the-differences

This sort of work but not exactly:

fc D:\Logs\Allchannels.txt D:\Logs\check.txt > D:\Logs\missing.txt

The output this gives is a list of whats in both files, then the user will have to manually have to look at the files and find out the difference themselves.

What I want is a text file that only shows what's missing between the two.

Example of whats in the two fils:

file 1:

  • Cart

  • Box

  • Money

file 2:

  • Cart

  • Money

so the output on the 3rd file should be Box as this is the value that's missing.

You could use Git BASH https://gitforwindows.org/
and do similar to what you had, with this command:

git diff path/to/file-1 path/to/file-2 > diff.txt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM