c# - 如何通过 C# 程序运行外部程序?

标签 c#

如何通过 C# 程序运行记事本或计算器等外部程序?

最佳答案

也许它会对你有所帮助:

using(System.Diagnostics.Process pProcess = new System.Diagnostics.Process())
{
    pProcess.StartInfo.FileName = @"C:\Users\Vitor\ConsoleApplication1.exe";
    pProcess.StartInfo.Arguments = "olaa"; //argument
    pProcess.StartInfo.UseShellExecute = false;
    pProcess.StartInfo.RedirectStandardOutput = true;
    pProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
    pProcess.StartInfo.CreateNoWindow = true; //not diplay a windows
    pProcess.Start();
    string output = pProcess.StandardOutput.ReadToEnd(); //The output result
    pProcess.WaitForExit();
}

关于c# - 如何通过 C# 程序运行外部程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3173775/

相关文章:

c# - 使用 ASP.NET session 状态服务跨应用程序共享 session

c# - 将数据从 SQL Server 导出到 C# 中的文本文件(保存到特定文件夹)

c# - ExecuteNonQuery 不起作用

c# - 在 TextBox 中启用除最后 N 个字符之外的密码字符/限制屏蔽字符

c# - OutOfMemoryException 仅在使用 VS2010 编译时在 Release 模式下出现?

c# - 打印千位前加点、分前加逗号的数字

c# - 获取类中所有方法的属性列表

c# - 如何以编程方式访问 Windows 8 文件历史记录?

c# - 使用C#访问网站

C# 音频到网络服务器 UDP