Running external executables from C#.NET (2005)

Is there a way to run an external .exe from within a C#.NET app

Obviously, the shell is a vb deal...

Dwaine



Answer this question

Running external executables from C#.NET (2005)

  • Flying B



    try
    {
    string applicationPath = @"c:\MyFolder\MyApp.exe";
    Process.Start( applicationPath );
    }
    catch( Exception caught )
    {
    MessageBox.Show( "Error while starting application.\r\n\t\nDetails:\r\n" + caught.Message );
    }



  • Agner

    Thank you very much!
  • Dave555

    You can use the Process clas in the Diagnostics namespace to start an external process.
    Here's a small code snippet which you can use to start an external exe.

    Code Snippet:
    ==========
    using System;
    using System.Collections.Generic;
    using System.Text;
    //you will need the Diagnostics Namespace for using Process class
    using System.Diagnostics;

    class Program{

    static void Main(string[] args)
    {

    Process newProcess = new Process();
    string path = @"FULL_PATH_OF_THE_EXTERNAL_EXE";
    newProcess .StartInfo.FileName = path ;
    newProcess .Start();
    }
    }

    HTH,
    Prakash

  • Running external executables from C#.NET (2005)