C#调用exe程序

private void ExecCheckExe()
{
    string exefile = "d:\\chktool\\checktool.exe";
    if (File.Exists(exefile))
    {
        Process process = new Process();
        ProcessStartInfo startInfo = new ProcessStartInfo(exefile);
        startInfo.UseShellExecute = false;
        startInfo.RedirectStandardOutput = true;
        startInfo.CreateNoWindow = true;
        process.StartInfo = startInfo;
        process.Start();
        process.WaitForExit(2000);
        string output = process.StandardOutput.ReadToEnd();

        process.Close();
    }
}

posted @ 2020-05-02 10:29  jiftle  阅读(3513)  评论(0编辑  收藏  举报