c# - 在C#中调用exe程序

标签 c#

如何从一个 C# 文件调用另一个 C# 文件生成的 exe?

最佳答案

using System.Diagnostics;

string command = @"C:\tmp\myExe.exe -my -params";

ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/c " + command)
    {
        RedirectStandardOutput = true,
        UseShellExecute = false,
        CreateNoWindow = true
    };

using (Process proc = new Process())
{
    proc.StartInfo = procStartInfo;
    proc.Start();

    return proc.StandardOutput.ReadToEnd();
}

关于c# - 在C#中调用exe程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2833171/

相关文章:

c# - 在哪里为所有 HttpRequest 设置自定义 ClaimsPrincipal

c# - Master-Details View 中的 RenderTargetBitmap GDI 句柄泄漏

c# - Async CTP : Does Task. Factory.StartNew 使用 IO 完成线程?

c# - 我计算基本括号表达式的算法的缺陷在哪里?

c# - 如何获取另一个线程的 ThreadStatic 值?

c# - 为什么许多 WPF 类将 boolean 值存储为枚举标志?

c# - 来自相关资源的 ImageSource

c# - 用于构建自动化的 powershell 或 python

c# - 串联列表中的项目以在 WPF 组合框 Itemssource 中使用

c# - 确保数据结构中值唯一性的最佳方法?