Q:

Batch file to compare the differences in two csv files

I use windows 7.
I have two csv files file1.csv and file2.csv
file1.csv
emp_id;salary
1;1000
2;2000
3;3000

file.csv
emp_id;salary
1;1000
2;2000
3;3000
4;4000
5;5000

I'm confused how to write a batch file.
The batch file should output the should be a csv file showing the changes.
Sample output:
emp_id;salary
4;4000
5;5000

A:

You can use findstr to look for differences, and the /v parameter to display differences. Like so:
findstr /v /g:"file1.csv" "file2.csv"

Also:
for /f "delims=" %%a in (file1.csv) do (
    findstr "^%%a$" "file2.csv" >nul ||echo %%a
)

And using the fc command:
fc "file1.csv" "file2.csv"

For fc im sure you can use an if not errorlevel 1 echo No difference

