I want to add a program to my project to run it with the System.Diagnostics.Process.Start ();

0

Good, waiting for your kind help, the problem is this, I am developing a windows form application in C #, I have a form, to run an external application using the System.Diagnostics.Process.Start ("file address" );

In my form, I have a button that when clicking, you must open the installer of another application, the inconvenience, it is not like doing to execute a program that is inside the project.

I want to imply it is like opening aplicacion.exe from miprograma.exe with a button, and that both files are in the same unit, like for example a cd.

    
asked by Sergio Roger 02.10.2017 в 03:40
source

2 answers

0

Good Sergio,

If the application you want to run is in the same directory of the program that you are running, just putting the name of the program you want to run in Process.Start() would be worth it:

System.Diagnostics.Process.Start("nombre aplicación");

The fact is that when you provide a name only where an address should go (path) it puts the path where you are running the application automatically.

    
answered by 02.10.2017 / 08:16
source
0

Good morning, I leave an example of how to open an executable from another application.

    private void btnWeb_Click(object sender, EventArgs e)
    {
        string ruta = "\Program Files\Iris Browser\IrisBrowser.exe";
        //ruta: Direccion donde se encuetra la aplicacion.
        //"": Parametro en caso de que tu aplicacion este esperando un valor
        ProcessStartInfo info = new ProcessStartInfo(ruta, "");
        try
        {
            Process.Start(info);
        }
        catch (Exception)
        {
            MessageBox.Show("No se encontro el archivo");
        }
    }

I hope and it will be useful. Greetings.

    
answered by 02.10.2017 в 19:38