3

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

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

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

现在我想以编程方式将带有文件名的比较报告保存在我桌面上的某个位置。

我搜索了文档,但在保存报告时找不到任何内容。

目前,上面的代码执行会打开一个窗口,如图像中所示(不要与窗口上的黑色部分混淆,我已将其着色以隐藏文件位置) 不要与窗口上的黑色部分混淆,我用这种方式着色它以隐藏文件位置

提前致谢。

4

1 回答 1

1

我在 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

现在使用命令提示符运行以下代码 BeyondCompate.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);
于 2014-01-10T12:22:31.983 回答