StreamReader sr = new StreamReader(file); string command = sr.ReadLine(); ProcessStartInfo startinfo=null; Process proc=null; startinfo = new ProcessStartInfo(); try{ startinfo.FileName = "C:\\WINNT\\system32\\cmd.exe"; startinfo.Arguments = command; startinfo.UseShellExecute = false; startinfo.CreateNoWindow=false; proc = Process.Start(startinfo); proc.WaitForExit(60000); }catch(Exception ee) { Console.Write("OR Error is here: "+ee.ToString()); }finally{ proc.Close(); proc=null; startinfo=null; }
StreamReader sr = new StreamReader(file);
ReplyDeletestring command = sr.ReadLine();
ProcessStartInfo startinfo=null;
Process proc=null;
startinfo = new ProcessStartInfo();
try{
startinfo.FileName = "C:\\WINNT\\system32\\cmd.exe";
startinfo.Arguments = command;
startinfo.UseShellExecute = false;
startinfo.CreateNoWindow=false;
proc = Process.Start(startinfo);
proc.WaitForExit(60000);
}catch(Exception ee)
{
Console.Write("OR Error is here: "+ee.ToString());
}finally{
proc.Close();
proc=null;
startinfo=null;
}