调试Process.Start()不传递给下一步

时间:2014-04-09 14:56:00

标签: c# process.start

我正在考虑执行一个进程:

public static bool ExecuteApplication(string executablePath, string arguments, bool wait, int waitingTime)
{
    bool success = false;
    if (CommonFiles.Exists(executablePath)) 
    {
        Process application = new Process();
        application.StartInfo.FileName = Path.Combine(executablePath);
        application.StartInfo.Arguments = arguments;
        application.StartInfo.WorkingDirectory = GetExpertPath();
        application.Start();
        if (wait) 
        {
            if (!application.WaitForExit(waitingTime)) 
            {
                application.Kill();
            }
            else 
            {
                success = true;
            }
        }
    }
    return success;
}

代码转到application.Start()但不转到下一行。 该过程开始和结束,但我的代码被阻止。 在此代码之前,还有更多的流程执行。

仅测试此代码即可运行。

使用application.StartInfo.UseShellExecute = false;代码也会进入下一步。

有什么想法吗?

0 个答案:

没有答案
相关问题