How To Start A Program/Process

To start a program in C#, you can use the Process class. The Process class has a static method called Start which accepts a filename as a parameter. The example below shows how easy it is to start Microsoft Notepad from a C# application. Remember to include the “using System.Diagnostics;” directive at the top.
  1. const string ProgramPath = “Notepad”;      
  2. Process.Start(ProgramPath);    
Note that if you need to start a program which accepts command line arguments, then you can use an overload of the Start method which accepts a ProcessStartInfo object. The following snippet shows how to open a file within notepad from your C# application.
  1. const string ProgramPath = “Notepad”;      
  2. Process.Start(      
  3. new ProcessStartInfo    
  4. {    
  5.    FileName = ProgramPath,    
  6.    Arguments = @”C:\WriteTest.txt”    
  7.    }      
  8. );