Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Compare two files  (Read 2865 times)

0 Members and 1 Guest are viewing this topic.

dworley

    Topic Starter


    Beginner

    Thanked: 1
    Compare two files
    « on: July 03, 2008, 11:11:59 AM »
    I am looking for a command that will allow me to compare the contents of two simple files and return a binary-type response (yes/no, positive/negative, 0/1, something like that).

    Ideally, something like this

    C:\[*compare*] $temp1$ $temp2$

    where the output/return is:

    1 (or 0)

    Thanks!
    -Darryl
    Have you forgotten?

    Dias de verano

    • Guest
    Re: Compare two files
    « Reply #1 on: July 03, 2008, 11:13:17 AM »
    fcomp.bat

    @echo off
    set same=0
    fc %1 %2>nul&&set same=1
    echo %same%


    fcomp file1 file2
    fcomp "file one" "file two"

    echoes 1 to stdout if files are identical, echoes 0 if they are not.
    « Last Edit: July 03, 2008, 11:58:15 AM by Dias de verano »