Support question of the week: Start a file compare only if files are different

Support question of the week...

The following tip is a bit on the advanced side, but many of you are advanced computer-users, so I think you will enjoy this.

We received a support question this week from a user who wanted to compare two large files with UltraCompare. Since the files were large, he only wanted to show the GUI if the files were different.

As some of you know, you can use the command line quick difference check to quickly test whether two files are different or the same. However, there is not an explicit feature to launch the GUI if the files are different - though it may be something we would consider in a future release.

After a short bit of Googling... Our support team was able to determine a method to support this mode of operation using a DOS batch file.

DISCLAIMER: I am not well-versed (at all) in writing DOS batch files, so there may be an easier/better way to approach this, but the following batch file will accomplish the scenario above.

The following batch file will compare c:\temp\test.txt and c:\temp\test1.txt. If the files are identical, you will see "Same" in the command prompt. If the files are different, UltraCompare will open for further interaction:

@echo off
uc -qc c:\temp\test.txt c:\temp\test1.txt | find "Different" > nul
If not errorlevel 1 (uc c:\temp\test.txt c:\temp\test1.txt) Else (echo Same)

For all of you "power users" out there.... Please post a comment if you have a suggestion to improve the batch file.

Back to Top