我使用 C# 為 Python 應用程序制作 GUI。我應該在 cmd 窗口中運行 python 應用程序,因為它有輸出顯示給用戶。我實際上使用這個片段成功地做到了這一點:Process runProg = new Process();runProg.StartInfo.FileName = @"C:\Windows\System32\cmd.exe";runProg.StartInfo.Arguments = @"/c py " +botFilePath +" --config_path=" + configFilePath + " --config_index=username_" + index.ToString();runProg.StartInfo.CreateNoWindow = true;runProg.Start();pIds[index] = System.Convert.ToInt32(runProg.Id.ToString());但是,如果我用這段代碼打開 3 個進程,它會工作得很好,但過一會兒它會關閉其中的 2 個進程并繼續運行其中一個。所以它將關閉 2 cmd 并只保留我打開的最后一個。如何保持 3 個 cmd 窗口打開并運行?
C# - 在 C# winForm 應用程序中打開多個 cmd 窗口
慕婉清6462132
2021-11-28 20:20:08