C# 如何使程序从c中的控制台应用程序在后台运行#
您好,我目前正在处理一个控制台应用程序,它运行的是一个.bat文件,当程序启动时,它会弹出作为我窗口上的主框,因为它一分钟运行几次,这可能会有点烦人。当我运行这个命令时,有没有办法C# 如何使程序从c中的控制台应用程序在后台运行#,c#,console,batch-file,C#,Console,Batch File,您好,我目前正在处理一个控制台应用程序,它运行的是一个.bat文件,当程序启动时,它会弹出作为我窗口上的主框,因为它一分钟运行几次,这可能会有点烦人。当我运行这个命令时,有没有办法 System.Diagnostics.Process.Start(@"newmessage1.bat"); 有没有办法使.bat cmd窗口在某种隐藏状态下运行?您可以使用和属性进行一些操作: var psi = new ProcessStartInfo { FileName = "newmessage1.
System.Diagnostics.Process.Start(@"newmessage1.bat");
有没有办法使.bat cmd窗口在某种隐藏状态下运行?您可以使用和属性进行一些操作:
var psi = new ProcessStartInfo
{
FileName = "newmessage1.bat",
CreateNoWindow = true,
UseShellExecute = false
};
Process.Start(psi);
使用属性
Process myProcess = new Process();
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.StartInfo.FileName = @"newmessage1.bat";
myProcess.Start();