External Conversion Rules

BC2 logo BC version 2 only

Beyond Compare is limited to comparison of plain text files.  To compare binary files, or to format files before comparison, Beyond Compare can call an external program to generate a temporary text file for comparison.  The following details the conversion process.

To access settings for external conversion in the File Viewer, select Tools | Edit Current Rules.  Go to the Conversion tab.

Variables for external conversion

%s - source file and path
%t - target file and path
%n - source filename
%x - extension of the source file

Reading

When reading a file, Beyond Compare calls the reading conversion tool.  It provides the real source filename and a temp file for the output.

Example "Run when loading:"

FooConvert\FooToText.exe %s %t %n

The variables are filled with:

%s - C:\file.foo
%t - C:\DOCUME~1\<username>\LOCALS~1\Temp\BC2D3.tmp
%n - file.foo

The conversion rule is called twice, once for the left side file and once for the right side file.

Saving

Most of the conversion tools we provide don't have a method to save files back to the original binary format.  This is why most files opened with conversion rules list the files as read-only in the File Viewer's status bar.

When a file is saved, the source filename is a temp file containing the converted text.  The target filename is an empty text temp file.  The name variable holds the original filename.  When the conversion process is done, Beyond Compare copies the target (%t) temp file to the original filename.

Example "Run when saving:"

FooConvert\TextToFoo.exe %s %t %n

The variables for save are expanded with:

%s - C:\DOCUME~1\<username>\LOCALS~1\Temp\BC2D8.tmp
%t - C:\DOCUME~1\<username>\LOCALS~1\Temp\BC2D9.tmp
%n - file.foo

Copyright © 2017 Scooter Software, Inc.