PDA

View Full Version : Command line script


31-Mar-2004, 11:28 AM
I would like some examples of writing a script to be used from the command line to do a binary compare between 2 files and send the mismatches to a file. Thank you for any help

Chris
31-Mar-2004, 03:47 PM
Here is an example script that will compare two folders using binary comparison and output the result to a text file

Run this using the command bc2 @script.txt

criteria binary
load c:\bc\orig c:\bc\new
expand all
folder-report layout:side-by-side options:display-mismatches output-to:binarydiff.txt



Or in a more general form using the folders to compare and output file name as command line parameters (bc scripts take command line paramters as %1, %2, %3 etc) with the following syntax:
bc2 @script.txt folder1 folder2 outputfile.txt

criteria binary
load %1 %2
expand all
folder-report layout:side-by-side options:display-mismatches output-to:%3

01-Apr-2004, 07:26 AM
This works great for folder comparison, but I want to run a file comparison which creates an outout file of all the mismatches automatically. Currently, the script is runs and opens the file viewer. I have to manually save to a file. Is there a way to do this without going through the viewer in the same way the folder is compared?

Chris
01-Apr-2004, 08:05 AM
The file-report will only report on selected files, so you need to use a select command.

You can also use an alternate sytax for file report explicitly giving it file names to compare:
file-report layout:side-by-side options:display-mismatches
output-to:differences.txt file1 file2

Where file1 and file2 are the files you would like to compare.