Need example of @COMPARE

I need a working example of how to use @COMPARE. I can not decipher the cryptic syntax. Then wrap it in an IF statement so I see the structure.

Say I have files test1.exe and test2.exe, and I want to print out a message if they match or not.
 
B

BillMc

Guest
On Sun 23-Nov-08 10:38pm -0600, deleyd wrote:

.> I need a working example of how to use @COMPARE. I can not
.> decipher the cryptic syntax. Then wrap it in an IF statement
.> so I see the structure.
.>
.> Say I have files *test1.exe* and *test2.exe*, and I want to
.> print out a message if they match or not.

The function @compare returns true if the contents of two files
are the same - the time stamps can be different.

Here's your example:

if %@compare[test1.exe,test2.exe] == 1 (echo Equ) else (echo Neq)

Of course, if you want it to be more robust, create a batch file.
Below is a batch file called compare.btm:

iff "x%1" == "x" .or. "x%2" == "x" then
echo Usage: compare file1 file2
quit
elseiff %@index[%1,ftp:] != -1 .and. %@index[%2,ftp:] != -1 then
echo Both files may not be FTP files
quit
elseiff not isfile "%1" then
echo "%1" isn't a file!
if not isfile "%2" echo "%2" isn't a file!
quit
elseiff not isfile "%2" then
echo "%2" isn't a file!
quit
elseiff %@compare[%1,%2] eq 1 then
echo They match!
else
echo They do not match.
endiff

--
Best regards,
Bill
4nt 8.02.106 / tcmd 9.02.152 cp 2.11.34 on xp pro sp3
 
Similar threads
Thread starter Title Forum Replies Date
vefatica Need help with XML Support 3
MikeBaas How to? I need help with RD Support 5
D Need to set Take Command font size when switching to high DPI display Support 0
J Need activation help. Support 1
vefatica gcd() and lcm() ... need '%' Support 10
C Cmpr_Del.btm need help understanding UDF..... Support 2
C Touch command — I Need to touch matching files in another directory. Support 5
D I need a debug-plan Support 4
vefatica New desktop, need Explorer PID Support 1
Frank How to? need help with "function" Support 10
R How to? i need a little help Support 3
B Need To Deactivate V12.1 Before Reinstall To Different Directory? Support 3
S Re: Release of new version - do we need to download again? Support 8
O Need 'grep' equivalent Support 13
S Need help to execute TCC commands on another system Support 6
vefatica What environment variables does IDE need? Support 3
T Expired trial...need to evaluate new build Support 1
H I need a little help. Support 4
C how to copy to folder where I need admin rights Support 5
M Need help Support 0
P Need to use a regex in a "for" loop. Support 54
H New to TCC and I need assistance Support 8
Dan Glynhampton Documentation v15 help: Syntax error in example of @DEC Support 0
D ini directives and @select example in Help Support 0
W JABBER help/example? Support 11
dcantor @DATE help example Support 0
dcantor @AGEDATE example incorrect in help Support 0
millardjk Example using @WINAPI/@CAPI Support 5
R How to? Compare executables' version/build # including 123.456.789.01 Support 10
M How to? Compare file timestamps accross different file systems... Support 1
C custom string compare? Support 8
C Suggestions for Compare Folder Tree routine Support 5
MickeyF how to compare version strings Support 11
R best file compare util Support 5
p.f.moore Compare 2 directories Support 8

Similar threads