After
p.WaitForExit();
Don't forget to check its return value to make sure it actually was successful:
if(p.ExitCode == 0) {
}
If you are still having problems, move the code to its own function and run manually:
private int RunProcess(string workDir, string appName, string args, bool hide = false)
{
string batrun = string.Format("cmd.exe","/c" + @"C:\Abhay\batfile");
proc = new Process();
proc.StartInfo.WorkingDirectory = workDir;
proc.StartInfo.FileName = appName;
proc.StartInfo.Arguments = args
proc.StartInfo.CreateNoWindow = hide;
proc.Start();
proc.WaitForExit();
return p.ExitCode
}
Then testing and using from your timer event becomes very easy:
var result = RunProcess("c:\", "file.Bat", "", false);
if (result == 0)
{
// success
}
else
{
// failed ErrorLevel / app ExitCode
}