How to Open Application using C#



Applications are launched using Process.Start method. The file path or url is passed as a parameter.




// 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("http://www.csharp-examples.net");



// open PDF file

System.Diagnostics.Process.Start(@"c:\document.pdf");

No comments:

Post a Comment