如何通过编程保存由Beyond Compare生成的比较报告

3

我有一段代码,其中我正在使用Beyond Compare比较两个文件。

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

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

现在,我想通过编程的方式将比较报告保存到桌面上的某个位置,并命名文件。我搜索了文档,但没有找到有关保存报告的任何内容。当前,以上代码执行会打开一个窗口,如图所示(不要被窗口上的黑色部分弄混,我已经用这种方式着色以隐藏文件位置)。提前感谢您的帮助。
1个回答

2

我在Beyond Compare的文档页面上找到了解决方案。

将以下行添加到文件中,并将其保存为My Script.txt

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

现在使用命令提示符运行以下代码:BeyondCompare.exe @"My Script.txt" "1.txt" "2.txt" "Save.html",这将把报告保存在Save.html中。

我将其添加到我的代码中:

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);

要了解为什么要使用“/c”,请参考https://dev59.com/hG445IYBdhLWcg3wE2Xw。 - anurag

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接