Open a file with the system’s default application in C#

invoke a file's default application

Sometimes you might want your program to use a default application to open a file. For example, you might want to display a PDF file, web page or URL on the internet.

The System.Diagnostics.Process class’s Start method starts the application that your system associates with a file. For example, if the file has a .txt extension, then the system opens the file in NotePad, WordPad, or whatever program is associated with .txt files.

Similarly if the file has a .html extension, the system opens it in your system’s default browser. Note that the file can be a URL such as or even just

In this example, when you select a file name from the ComboBox or type a file name of your own and click Open, the program uses the following code to open the file.

// "Start" the file.
private void btnOpen_Click(object sender, EventArgs e)

Download Example   Follow me on Twitter   RSS feed

This entry was posted in files, programs, system and tagged , , , , , , , , , , , , , , , , . Bookmark the permalink.

2 Responses to Open a file with the system’s default application in C#

  1. Truong says:


Leave a Reply

Your email address will not be published. Required fields are marked *