Friday, February 6, 2009

Running a .bat file using C# Process

Process.Start(@"C:\
Program Files\Adobe\After Effects 6.5\Support Files\afterfx.exe", "-r " + path2);


1 comment:

  1. 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;
    }

    ReplyDelete