Open File With Associated Application [C#]

This example demonstrates how to open file with an associated program. It shows, how to open text document in notepad, how to open image in a default viewer or how to open url address in a default web browser.

// open text file in notepad (or another default text editor) System.Diagnostics.Process.Start(@"c:\textfile.txt");
// open image in default viewer System.Diagnostics.Process.Start(@"c:\image.jpg");
// open url in default web browser System.Diagnostics.Process.Start("https://www.csharp-examples.net");
// open PDF file System.Diagnostics.Process.Start(@"c:\document.pdf");

Similarly you can open Word document or any other file from your .NET application.

Files and Folders Examples

See also

Copyright © 2019 Jan Slama.