JSI Tip 7510. Freeware Compare.exe performs various string comparisons.


Download Compare.zip to compare two strings with either ASCII sort, string sort, or word sort.

When you type compare /?, you receive:

Version 0.7, Copyright (C)2002, Frank P. Westlake.
Performs string comparisons.

COMPARE \[SortType\] "String 1" \[ComparisonType\] "String 2"

         SortType             ComparisonType
         /ASCII               /LSS
         /STRING (default)    /LEQ
         /WORD                /EQU

/e    The string following is an environment variable name whose contents is to
      be compared.
/i    Comparison is NOT case sensitive. When used with the ASCII SortType the
      result will not be a true ASCII sort.
/q    Quiet. Does not print test results but ERRORLEVEL is still set.

If ComparisonType is NOT specified then ERRORLEVEL will be set as follows:
  1=String 1 is  LESS  THAN  String 2
  2=String 1 is   EQUAL TO   String 2
  3=String 1 is GREATER THAN String 2

If ComparisonType IS specified then the ERRORLEVEL will be set as follows:

Any ERRORLEVEL greater than 15 indicates an error (4-15 are reserved).

  COMPARE dogs /gtr "cats meow"
  COMPARE /i /e PATH /equ C:DOS

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.