J'ai trouvé ce code qui me permet de lancer un fichier bat :
// Get the full file pathstring strFilePath = Server.MapPath(".") + "\\" + Session["Login"].ToString() + ".bat";// Create the ProcessInfo objectSystem.Diagnostics.
ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("cmd.exe");psi.UseShellExecute =
false;psi.RedirectStandardOutput =
true;psi.RedirectStandardInput =
true;psi.RedirectStandardError =
true;psi.WorkingDirectory = Server.MapPath(
".");// Start the processSystem.Diagnostics.
Process proc = System.Diagnostics.Process.Start(psi);
// Open the batch file for readingSystem.IO.
StreamReader strm = System.IO.File.OpenText(strFilePath);// Attach the output for readingSystem.IO.
StreamReader sOut = proc.StandardOutput;// Attach the in for writingSystem.IO.
StreamWriter sIn = proc.StandardInput;
// Write each line of the batch file to standard inputwhile (strm.Peek() != -1){
sIn.WriteLine(strm.ReadLine());
}
strm.Close();
// Exit CMD.EXEstring stEchoFmt = "# {0} run successfully. Exiting";sIn.WriteLine(
String.Format(stEchoFmt, strFilePath));sIn.WriteLine(
"EXIT");// Close the processproc.Close();
// Read the sOut to a string.string results = sOut.ReadToEnd().Trim();
// Close the io Streams;sIn.Close();
sOut.Close();