c# - 如何以编程方式保存 Beyond Compare 生成的比较报告

标签 c# automation save beyondcompare

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

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

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

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

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

目前上面的代码执行打开了一个窗口,如图所示 (不要与窗口上的黑色部分混淆,我已将其着色以隐藏文件位置) don't get confused with the black part on the window, i have colored it that way to hide file locations

提前致谢。

最佳答案

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

关于c# - 如何以编程方式保存 Beyond Compare 生成的比较报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20949013/

相关文章:

python - 使用 np.load 和 np.save 从磁盘加载数组和字典后使用它们

c# - 我将如何返回具有最旧日期时间的顶级 FileInfo 对象?

c# - 如何在邮件中添加 Outlook VSTO 2010 上下文菜单?

ruby - Watir 更改 Mozilla Firefox 首选项

python - 使用导入的自定义包加载 iPython

swift - PNG 图像未保存到文档目录

c# - MEF——我似乎在这里遗漏了一些东西

c# - MySQL 数据库空问题

batch-file - 根据文件数量将文件从文件夹移动到新文件夹

grails - grails 中保存和更新方法的习惯用法