using System; using System.Dignostics; using System.Web.UI; public partial class RunExecutable : Page { protected void Page_Load(object sender, EventArgs e) { try { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.Filename = @"Z:\Easy_Transports\Lancement_Pocketbase.cmd"; startInfo.UseShellExecute = false; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; startInfo.CreateNoWindow = true; using (Process exeProcess = Process.Start(startInfo)) { string output = exeProcess.StandardOutput.ReadToEnd(); string error = exeProcess.StandardError.ReadToEnd(); exeProcess.WaitForExit(); Response.Write("Output: " + output); Response.Write("error: " + error); } } catch (Exception exe) { Response.Write("Exception: " + ex.Message); } } }