2009-09-25 53 views
2

我有一個msi安裝程序,需要調用幾個批處理文件才能完成安裝過程。批處理文件將額外文件從安裝程序複製到幾個目錄,然後修改其中幾個目錄的權限。我們希望繼續使用批處理文件,因爲我們的開發時間表中沒有太多時間。我沒有使用WIX。如何從MSI調用批處理文件

如果可能,我想捕獲該批處理的輸出並將其寫入日誌文件。

發現波紋管是我用來嘗試從自定義操作運行批處理文件的代碼。它打開一個cmd窗口,運行一段時間,但似乎從未完成。如果我直接從命令提示符運行相同的批處理文件,它們就可以工作。

//Set the environment to the directory containing the bat files 

ProcessStartInfo info = new ProcessStartInfo(batch); 
info.WindowStyle = ProcessWindowStyle.Hidden; 
info.UseShellExecute = false; 
info.RedirectStandardError = true; 
info.RedirectStandardOutput = true; 
if (!string.IsNullOrEmpty(argument)) 
    info.Arguments = argument; 

Process process = new Process(); 
process.StartInfo = info; 
process.Start(); 

// Capture the standard error and standard output 

我在做什麼錯?

+0

原來的問題,我有是一個記錄過程的一部分。如果沒有寫入日誌消息,則讀取過程將阻止安裝程序。這顯然很糟糕,讓我的生活感到悲傷。 – smaclell 2009-10-01 23:12:52

回答

2

我相信你需要創建一個自定義操作。見this question

+0

我想我只需要更努力地工作。感謝您的答覆。 – smaclell 2009-09-26 02:21:06

0

許多反病毒程序在安裝過程可能會停止的.BAT文件執行,你應該做這個使用標準的Windows安裝程序的功能或爲C++自定義操作

相關問題