我有一段代码,我正在使用Beyond compare比较两个文件。
string s = @""C:\Program Files\Beyond Compare 2\BC2.exe"";
Process.Start(s, @"c:\temp\File1.txt c:\temp\File2.txt" );
现在,我要以编程方式将“比较”报告与文件名一起保存在桌面上的某个位置。
我搜索了文档,但是在保存报告时找不到任何东西。
当前,上述代码执行打开一个窗口,该窗口在图像中可见
(不要与窗口上的黑色部分混淆,我已经用隐藏颜色的方式对其进行了着色)
提前致谢。
最佳答案
我在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 @“我的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);