设置一下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();