# Write a batch file that will start several text compares automatically

The example code in the following .bat file is hard coded to do three specific pairs of files, but with a little imagination you could add variables and a loop so that this will work for n number of files.

The gist of the process is:

1. Write a script for Beyond Compare that will run a Beyond Compare session. &#x20;
2. Write a single batch/shell script that repeatedly calls the script you wrote in (1)
3. Give a command in the terminal to start (2)

### &#x20;Step One <a href="#step-one" id="step-one"></a>

To make your Beyond Compare script, find one in Scooter Software's [list of examples](https://www.scootersoftware.com/v4help/index.html?sample_scripts.html) and then adapt it with Scooter's [syntax guide](https://www.scootersoftware.com/v4help/index.html?scripting_reference.html).  Wherever convenient, instead of fixed paths use %1, %2, et al as variables for arguments that can be entered later at the command-line.

My script here just compares one text file to another (%1 vs %2) and outputs the result to a location (%3).

`file-report layout:side-by-side & options:display-mismatches & output-to:%3 %1 %2`

Save this as *fileToFile.bc*

​

### Step Two <a href="#step-two" id="step-two"></a>

Write one batch file that repeatedly calls your script from Step 1:

> `start BComp.exe /solo @fileToFile.bc tigers1.csv tigers2.csv report1.txt`&#x20;
>
> `start BComp.exe /solo @fileToFile.bc out1.html out1.html report2.txt`&#x20;
>
> `start BComp.exe /solo @fileToFile.bc chennai.bc actemium.bc report3.txt`&#x20;

Save this as *threeTextCompares.bat*

### &#x20;Step Three <a href="#step-three" id="step-three"></a>

In Windows, type and enter this at the command line:

> threeTextCompares.bat

You should see three sessions of BC start up. Your results will be in the report1.txt, report2.txt, and report3.txt


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://beyondcompare.gitbook.io/project/scripts-and-the-command-line/write-a-batch-file-that-will-start-several-text-compares-automatically.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
