bloggerads

2013年1月3日 星期四

C# : Call a exe file without a command prompt blinking

using System.Diagnostics;


private static int RunProcess(string processName, string arguments)
{
    Process process = new Process();
    process.StartInfo.FileName = processName;
    process.StartInfo.Arguments = arguments;
 //* 
    process.StartInfo.UseShellExecute = false;
    process.StartInfo.RedirectStandardInput = true;
    process.StartInfo.RedirectStandardOutput = true;
    process.StartInfo.RedirectStandardError = true;
    process.StartInfo.CreateNoWindow = true;  //Without a command prompt blinking
 //&
    process.Start();
    process.WaitForExit();
    return process.ExitCode;
}

沒有留言:

張貼留言