Run program in a certain folder in IIS

2

I would like to know how to run an exe or jar program in a given IIS folder, through the C # .net core code. It would have to be a synchronous call, that is when the C # performs the call of the jar or exe or bat has to wait the processing and then continue.

    
asked by anonymous 05.06.2017 / 19:40

1 answer

2

Use Process.

 using System.Diagnostics;
 Process.Start("teste.exe");

Wait for the process to terminate.

using System.Diagnostics;
...
Process process = new Process();
// Configure o processo usando as propriedades do StartInfo.
process.StartInfo.FileName = "teste.exe";
process.StartInfo.Arguments = "-n";
process.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
process.Start();
process.WaitForExit();// espera o processo encerrar
    
05.06.2017 / 22:13