Terminal window with a Beyond Compare sync script and a generated HTML report card

Clicking through the same comparison every evening is the kind of job a computer should do for you. Beyond Compare includes a command line interface and a small scripting language that can load folders, pick files, copy or sync them, and write reports, all without opening a window. This guide starts with simple command line launches and builds up to a scheduled script that backs up a folder and leaves an HTML report behind.

The Two Ways to Start From the Command Line

Opening a comparison

On Windows, the program lives in BCompare.exe. Passing two paths opens them side by side:

"C:\Program Files\Beyond Compare 5\BCompare.exe" "C:\work\old.txt" "C:\work\new.txt"

On macOS and Linux, use the bcompare command, which you get after installing the command line tools on a Mac or the package on Linux:

bcompare ~/work/old.txt ~/work/new.txt

Beyond Compare picks the right view automatically: Text Compare for text files, Folder Compare for folders, Picture Compare for images, and so on.

Waiting for the result

Other programs often need to wait until you finish. That is what bcomp (or BComp.exe on Windows) is for. It opens the comparison and does not return until you close it, which is why version control tools use it. It also returns an exit code that tells the caller whether the files matched.

Writing Your First Script

A script is a plain text file with one command per line. You run it by passing the file name with an @ sign in front:

BCompare.exe @"C:\scripts\nightly-sync.txt"

Here is a complete example that backs up a project folder and writes a report:

log verbose append:"C:\logs\sync.log"
criteria timestamp:2sec size
load "C:\Projects" "E:\Backup\Projects"
filter "*.*;-*.tmp;-node_modules\"
expand all
select left.newer.files left.orphan.files
copy left->right
folder-report layout:summary options:display-mismatches output-to:"C:\logs\report.html" output-options:html-color

Line by line, it does the following:

  1. log writes every action to a log file so you can check what happened later.
  2. criteria tells Beyond Compare to treat files as equal when their size matches and their times are within two seconds.
  3. load opens the source folder on the left and the backup on the right.
  4. filter skips temporary files and a bulky dependency folder.
  5. expand all opens every subfolder so the next command sees all files.
  6. select picks files that are newer on the left or missing on the right.
  7. copy sends the selected files to the backup.
  8. folder-report writes a color-coded HTML summary of what still differs.

Common Script Commands

Command Purpose
load Opens two folders or a saved session
criteria Sets how files are judged equal
filter Includes or excludes files by pattern
select Picks files by state, such as newer or orphan
copy, move, delete Acts on the selected files
sync Runs an update or mirror in one step
folder-report, text-report Writes a report to a file
option confirm:yes-to-all Answers prompts automatically

The sync command is a shortcut for many backups. For example, sync update:left->right copies new and newer files from left to right, much like the Folder Sync session.

Tip: Build and test your script against small sample folders first. Once the log and report look right, point it at the real paths.

Writing a Report for Two Files

Scripts are not only for folders. This short example compares two versions of a document and saves a side-by-side HTML report:

text-report layout:side-by-side options:display-mismatches output-to:"C:\reports\changes.html" output-options:html-color "C:\docs\v1.txt" "C:\docs\v2.txt"

The report shows only the lines that differ, with color highlights, so a reviewer can see the changes in a browser without installing anything.

A Safety Checklist for Scripts

  • Start every script with a log line so each run leaves a record.
  • Test new scripts on copies of your folders before using real paths.
  • Prefer copy or sync update over delete and mirror until you trust the script.
  • Keep scripts in version control so changes are tracked.
  • Check the log after the first few scheduled runs, not just the first one.

Running Without a Window

Add the /silent switch on Windows to run a script with no visible interface:

BCompare.exe @"C:\scripts\nightly-sync.txt" /silent

That makes scripts suitable for scheduled jobs and build servers.

Scheduling the Job

On Windows

Open Task Scheduler, create a basic task, choose a daily trigger, and set the action to start BCompare.exe with the script argument and /silent. Run the task once by hand to confirm it works, then check the log file.

On macOS and Linux

Add a line to your crontab with crontab -e, for example:

0 22 * * * /usr/bin/bcompare @/home/me/scripts/nightly-sync.txt

That runs the script every night at 10 pm. Keep in mind that the Linux build needs a graphical session, so very minimal servers may need a virtual display.

Reusing Saved Sessions

You do not have to spell out every path and setting in a script. If you have already built a Folder Compare or Folder Sync session in the app, with its filters, comparison rules and folder pair, a script can load it by name. Write load "Nightly Backup" instead of the two folder paths, and the script inherits everything you configured. This keeps scripts short and means you can adjust filters in the familiar interface rather than editing text.

Sessions also make it easier to hand a job to a colleague. They can open the session, see exactly what it compares, and run it by hand to check the result before the scheduled version takes over.

Passing Values Into a Script

Scripts can accept arguments from the command line, written as %1, %2 and so on inside the file. That lets one script handle many jobs. For example, a single report script could take the two folders and the output file as arguments, and a scheduler could call it with different values for each project. It saves you from keeping a pile of nearly identical script files that drift apart over time.

Reading the Results

Exit codes from bcomp tell a calling program whether files matched, differed or hit an error. Scripts that run from build tools can check that code and fail the build when an important file changes unexpectedly. The HTML report, meanwhile, is easy to open in any browser or attach to an email so others can see the differences without installing anything.

Pros

  • Plain text scripts are easy to read, version and share
  • Reports in HTML or text can be shared with anyone
  • Silent mode and scheduling allow fully unattended jobs
  • Uses the same comparison engine as the interactive app

Cons

  • The script language has its own syntax to learn
  • The Linux build still expects a graphical session
  • Destructive commands need careful testing before real use

Frequently Asked Questions

How do I run a Beyond Compare script?

Pass the script file with an @ sign in front, for example BCompare.exe @"C:\scripts\job.txt". Add /silent on Windows to hide the window.

What is the difference between BCompare and BComp?

BCompare opens the program and returns right away. BComp waits until you close the comparison and returns an exit code, which suits version control tools.

Can scripts create reports?

Yes. The folder-report and text-report commands write summaries, side-by-side views or patch files in HTML or plain text.

Can I schedule a Beyond Compare script?

Yes. Use Task Scheduler on Windows or cron on macOS and Linux to run the script at set times.

Do scripts work in the Standard edition?

Yes. Scripting and the command line are included in both Standard and Pro.

Conclusion

Beyond Compare's command line and scripting turn routine comparisons into jobs that run themselves. Start by opening simple comparisons from a terminal, then write a short script that loads folders, selects changes, copies them and writes a report. Test it on sample data, add the silent switch, and then schedule it. Every morning you will have a fresh log and a clear report waiting for you.