从显示在c#shell窗口阻止子进程 [英] Prevent child process from showing a shell window in c#

查看:205
本文介绍了从显示在c#shell窗口阻止子进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的ffmpeg编译视频,我想阻止它显示执行动作时,控制台

I'm using ffmpeg to compile videos, and I'd like to prevent it from displaying a console when performing actions.

下面是我如何开始的ffmpeg:

Here's how I start ffmpeg:

ProcessStartInfo si = new ProcessStartInfo();
si.Arguments = string.Format("-y -loop 1 -t " + DucationToString(frameDuration) + " -r 25 -f image2 -i \"{0}\" \"{1}\"",
                             item.Value, otpt);
si.FileName = "ffmpeg";
si.UseShellExecute = false;

Process.Start(si).WaitForExit();



不管我尝试在的ProcessStartInfo 设置,控制台总是显示出来。

No matter the settings I try in ProcessStartInfo, the console always shows up.

我如何防止从创建子进程时,被显示在控制台?

How do I prevent the console from being shown when creating child process?

推荐答案

您应该尝试使用

ProcessStartInfo si = new ProcessStartInfo();
si.WindowsStyle = ProcessWindowStyle.Hidden;
si.CreateNoWindow = true;
si.UseShellExecute = false;
......

MSDN裁判

这篇关于从显示在c#shell窗口阻止子进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆