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