Friday, May 4, 2012

Run Process in background / hidden


// Run Process in background / hidden
//txtRebuildFolderBrowser.Text stands for a specific folder ex: C:\thedirectory
//rebuildFileName stands for a specific file eX: the.exe or the.bat

System.Diagnostics.ProcessStartInfo i = new
System.Diagnostics.ProcessStartInfo(txtRebuildFolderBrowser.Text + "\\" + rebuildFileName);
i.CreateNoWindow = true;
i.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
System.Diagnostics.Process p = System.Diagnostics.Process.Start(i); // inicia o processo do rebuild
p.WaitForExit(); //aguarda o processo terminar
MessageBox.Show("Process Complete","Process Info:");

No comments: