我需要从 C# 控制台应用程序启动一个进程,然后允许控制台应用程序完成/结束,而无需等待进程/线程完成。
我该怎么做呢?
您需要避免使您的新进程成为当前进程的子进程:
ProcessStartInfo sinfo = new ProcessStartInfo();
sinfo.UseShellExecute = true; // Do not wait - make the process stand alone
sinfo.FileName = "PathAndNameofExe";
Process.Start(sinfo);
Process.Start("TheNameOfTheOtherProcess.exe");