using System;
using System.Diagnostics;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var exitCode = -1;
using (Process proc = new Process())
{
//Set the working directory for the process to be started
proc.StartInfo.WorkingDirectory = @"C:\";
//Set the doucment name to start
proc.StartInfo.FileName = "StartAppPool.bat";
//Execute the process
proc.Start();
//Wait for the associated process to exit
proc.WaitForExit();
//Gets the value of the associated process specified when it terminated.
exitCode = proc.ExitCode;
}
if(exitCode == 0) Console.WriteLine("Batch executed successfully");
else Console.WriteLine("Some problem happened while executing the batch program");
Console.ReadKey();
}
}
}