gpt4 book ai didi

c# - 从 C# 启动应用程序 (.EXE)?

转载 作者:IT王子 更新时间:2023-10-29 03:31:17 26 4
gpt4 key购买 nike

如何使用 C# 启动应用程序?

要求:必须在 Windows XP 上工作和 Windows Vista .

我看到了一个来自 DinnerNow.net 采样器的示例,它只能在 Windows Vista 中运行。

最佳答案

这是一段有用的代码:

using System.Diagnostics;

// Prepare the process to run
ProcessStartInfo start = new ProcessStartInfo();
// Enter in the command line arguments, everything you would enter after the executable name itself
start.Arguments = arguments;
// Enter the executable to run, including the complete path
start.FileName = ExeName;
// Do you want to show a console window?
start.WindowStyle = ProcessWindowStyle.Hidden;
start.CreateNoWindow = true;
int exitCode;


// Run the external process & wait for it to finish
using (Process proc = Process.Start(start))
{
proc.WaitForExit();

// Retrieve the app's exit code
exitCode = proc.ExitCode;
}

您可以使用这些对象做更多的事情,您应该阅读文档:ProcessStartInfo , Process .

关于c# - 从 C# 启动应用程序 (.EXE)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/240171/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com