Question

I have a piece of code where I am comparing two files using Beyond compare .

string s = @""C:\Program Files\Beyond Compare 2\BC2.exe"";

Process.Start(s, @"c:\temp\File1.txt c:\temp\File2.txt" );

Now i want to save the Compare report with a filename and at a locationon my desktop programatically.

I searched the documents but could not find anything on saving the reports.

Currently the above code execution opens a window as is visible in the image (don't get confused with the black part on the window, i have colored it that way to hide file locations) don't get confused with the black part on the window, i have colored it that way to hide file locations

Thanks in advance.

Was it helpful?

Solution

I found the solution on documentation page of Beyond compare.

Add the following lines in file and save it with My Script.txt

file-report layout:side-by-side &
options:ignore-unimportant,display-context &
output-to:%3 output-options:html-color %1 %2

Now using command prompt run the following code BeyondCompate.exe @"My Script.txt" "1.txt" "2.txt" "Save.html" This will save the report in Save.html.

I incorporated this in my code as :

System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.FileName = "cmd.exe" ;
startInfo.Arguments = "/c" + "BeyondCompare.exe" + " " + @"My Script.txt" + " " + "1.txt" + " " + "2.txt" + " " +"Save.html";
System.Diagnostics.Process.Start(startInfo);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top