Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For example... I have txt file called New and txt file called Old... How can i create batch script to check both txt files and then create new text file with lines that aren't in both of them (New and Old txt files)? Thanks in advance...

share|improve this question
4  
If the lines aren't in either file how do you know what they are? –  Daniel R Hicks Mar 16 '13 at 12:02
    
I just want to compare both txt files... I know what is in Old and i just want to know if there is something new in New txt file and then if there some new line that isnt in Old print that in new text file... –  Noober Mar 16 '13 at 12:19
    
Why not open both up in notepad++ and set them to compare. It will also highlight where the differences are. That's if you are asking to compare code you made an error on and are looking for the differences to identify an area of possibility. –  Matt Mar 16 '13 at 18:38

2 Answers 2

I assume you meant to ask

How to check lines in two txt files and save lines that aren't in both of them in new text file?

A good command line tool is diff which you can get here for Windows. If that's what you are looking for then How can I get diff to show only added and deleted lines answers your question.

This question What is a good text comparison tool for Windows? lists comparison tools for Windows.

Wikipedia has a list of text comparison tools.

share|improve this answer
    
The classic answer would be to install a Linux partition or install Cygwin and use diff. –  Daniel R Hicks Mar 16 '13 at 17:41
FC new.txt old.txt > diff.txt

You can also check the ERRORLEVEL of FC to have your script respond to the files being different.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.