I want to write:
if these two files are different
then do this piece of code
else do that piece of code
endif
I know fc (filecompare) does not give an exit code
depending on de difference of the files.
In UNIX I would write
if cmp file1 file2
then echo files are equal
else echo files are not equal
fi
How do I do this in dos?
How to act on the difference of two files?
Moderator: DosItHelp
-
- Posts: 2
- Joined: 14 Feb 2006 13:18
- Location: holland
In WinXP fc does return an exit code and you could use:
However if the fc command in your windows version works different then you can try:
Code: Select all
fc "%file1%" "%file2%">NUL&&(
echo the files are equal
rem keep this rem as last command in the block
)||(
echo the files are different
)
However if the fc command in your windows version works different then you can try:
Code: Select all
fc "%file1%" "%file2%"|find "*****">NUL&&(
echo the files are different
rem keep this rem as last command in the block
)||(
echo the files are equal
)
-
- Posts: 2
- Joined: 14 Feb 2006 13:18
- Location: holland
-
- Posts: 6
- Joined: 01 Jul 2011 16:38
Re: How to act on the difference of two files?
What is the difference between fc and comp?