I'm trying to execute a batch file in C#, but although I have found multiple examples on the Internet it is not working for me.
My code:
ProcessStartInfo psi = new ProcessStartInfo(pathBat);
psi.Verb = "runas";
psi.UseShellExecute = false;
Process.Start(psi);
Content of .bat file:
MIL_detection_app.exe -monitor AEE86079 2>&1 | logger.exe
pause
MIL_detection_app.exe
is in the same folder. If I try to run .bat
by double click it works fine but when I try through C# code, a console show up and disappear in less than a second.
What am I doing wrong?