.net - How do I start a process from C#? -


how start process, such launching url when user clicks button?

as suggested matt hamilton, quick approach have limited control on process, use static start method on system.diagnostics.process class...

using system.diagnostics; ... process.start("process.exe"); 

the alternative use instance of process class. allows more control on process including scheduling, type of window run in and, usefully me, ability wait process finish.

using system.diagnostics; ... process process = new process(); // configure process using startinfo properties. process.startinfo.filename = "process.exe"; process.startinfo.arguments = "-n"; process.startinfo.windowstyle = processwindowstyle.maximized; process.start(); process.waitforexit();// waits here process exit. 

this method allows far more control i've mentioned.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -