C# 从c代码启动时隐藏cmd.exe窗口

C# 从c代码启动时隐藏cmd.exe窗口,c#,.net,cmd,C#,.net,Cmd,我正在winforms应用程序中运行cmd.exe进程。然而,我似乎无法让控制台窗口在后台运行,即不显示在屏幕上 这是我的密码 ProcessStartInfo si = new ProcessStartInfo("cmd.exe"); si.RedirectStandardInput = true; si.RedirectStandardOutput = true; si.UseShellExecute = false; si.Arguments = "/c"; si.WindowStyle

我正在winforms应用程序中运行cmd.exe进程。然而,我似乎无法让控制台窗口在后台运行,即不显示在屏幕上

这是我的密码

ProcessStartInfo si = new ProcessStartInfo("cmd.exe");
si.RedirectStandardInput = true;
si.RedirectStandardOutput = true;
si.UseShellExecute = false;
si.Arguments = "/c";
si.WindowStyle = ProcessWindowStyle.Hidden;
Process p = Process.Start(si); 

将CreateNowInow设置为true

si.CreateNoWindow = true;

将CreateNowInow设置为true

si.CreateNoWindow = true;