您好,我正在开发一个运行.bat文件的控制台应用程序,当程序启动时,它会弹出窗口中的主框,并且因为它每分钟运行几次,这可能会有点烦人我运行这个命令有什么办法......
System.Diagnostics.Process.Start(@"newmessage1.bat");
有没有办法让.bat cmd窗口以某种隐藏状态运行?
答案 0 :(得分:1)
您可以使用CreateNoWindow
和UseShellExecute
属性玩一下:
var psi = new ProcessStartInfo
{
FileName = "newmessage1.bat",
CreateNoWindow = true,
UseShellExecute = false
};
Process.Start(psi);
答案 1 :(得分:1)
使用ProcessStartInfo.CreateNoWindow
属性。
Process myProcess = new Process();
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.StartInfo.FileName = @"newmessage1.bat";
myProcess.Start();