Hello, I want to execute the batch file on server but the problem is that it can not execute. Even it is not giving any error. What should I do? this is my code
try
{
ProcessStartInfo info = new ProcessStartInfo(AppPath + @"bin\execute.bat");
info.UseShellExecute = false;
info.RedirectStandardInput = true;
info.RedirectStandardError = true;
info.RedirectStandardOutput = true;
info.CreateNoWindow = false;
//info.WindowStyle = ProcessWindowStyle.Minimized;
info.WorkingDirectory = AppPath + @"bin";
using (Process install = Process.Start(info))
{
string output = install.StandardOutput.ReadToEnd();
install.WaitForExit();
Response.Write(output);
Console.WriteLine(output);
string strError = install.StandardError.ReadToEnd();
if (install.ExitCode == 0)
{
// Ok = true;
}
else
{
Response.Write(" Running failed. Description: " + strError);
}
}
}
catch (Win32Exception e)
{
Response.Write("W32 Error:" + e.NativeErrorCode.ToString() + "." + e.Message);
}