標籤:des style class blog c code
MSI是安裝檔案,需要系統內建的msiexec.exe來執行
var tempDir = @"D:\UploadFiles\SCADASetupWix.msi"; var start = new ProcessStartInfo("msiexec.exe", "/i \"" + tempDir ); start.WindowStyle = ProcessWindowStyle.Normal; start.CreateNoWindow = true; Process.Start(start);//.WaitForExit()
但在360下,會由警告彈出。認為自動安裝是不安全的。 應該還有更好的方式。
在cmd中觸發安裝,也會彈出360警告。然後顯示拒絕安裝
自動運行EXE檔案,也會彈出警告。
Process prc = new Process(); try { prc.StartInfo.FileName = @"C:\Users\Administrator\Desktop\SCADA\setupok.exe"; prc.StartInfo.UseShellExecute = false; prc.StartInfo.RedirectStandardError = true; prc.StartInfo.RedirectStandardOutput = true; prc.StartInfo.RedirectStandardInput = true; prc.StartInfo.CreateNoWindow = false; prc.Start(); } catch (Exception exU) { if (!prc.HasExited) { prc.Close(); } throw new Exception(exU.Message.ToString()); }
應該有靜默的安裝方式。繼續尋找!