設置C#啟動進程但不顯示命令行窗口


設置一下Process類型相關的配置屬性即可,直接上代碼。

//記得引入命名空間
//using System.Diagnostics;
//獲得當前環境的基路徑
string basePath = Environment.CurrentDirectory;
//設置要啟動的程序文件位置
string filePath = @"\website\panda.exe";
ProcessStartInfo startInfo = new ProcessStartInfo(basePath + filePath);
//設置不在新窗口中啟動新的進程
startInfo.CreateNoWindow = true;
//不使用操作系統使用的shell啟動進程
startInfo.UseShellExecute = false;
//將輸出信息重定向
startInfo.RedirectStandardOutput = true;
//新建進程
Process process = new Process();
//設置啟動信息
process.StartInfo = startInfo;
//啟動進程
process.Start();


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM