Launch an application process from your .NET application

 I was just trying to open a web browser to a specific url when a user clicks a button in my application and it was so easy.

You can use the System.Diagnostics.Process class to start an application as follows:
Process.Start( fileName );

The cool thing about using Process.Start is that you can open files that are not executables as long as there is a registered application to handle them.  For instance you could open a Word document by just specifying the path to the .doc file you don’t need to specify the WinWord.exe.

Opening a web browser and navigating to a URL is as easy as using
Process.Start (““);

Additionally you can use the ProcessStartInfo class to specify more info that is used to launch the application.  For instance you can specify verbs.  By default the verb used is “open”.  For Word you can specify a “print” verb which will just print the document.


Comments (1)

  1. You should remove the iexplorer.exe to launch a URL… what if that isn’t their default browser? discusses this a bit… and Ryan Farley discusses it here