2014-01-06 123 views
3

我有一段代碼,我在比較使用超越比較兩個文件。如何保存由比較生成的比較報告

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

提前致謝。

回答

1

我在超越比較的文檔頁面找到了解決方案。

添加以下行的文件,現在使用命令提示符下運行下面的代碼 BeyondCompate.exe @「我Script.txt」「的1.txt」,「與我的Script.txt

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

保存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); 
+0

要知道,至於爲什麼是「/ C」使用,指http://stackoverflow.com/questions/5047171/passing-an-argument-to -cmd-EXE – anurag