使用命令行参数在 C# 中运行 exe,抑制 dos 窗口
我正在使用 lame 为我的一个项目进行转码。问题是,当我从 C# 调用 lame 时,会弹出一个 DOS 窗口。有什么办法可以抑制这种情况吗?
到目前为止,这是我的代码:
Process converter =
Process.Start(lameExePath, "-V2 \"" + waveFile + "\" \"" + mp3File + "\"");
converter.WaitForExit();
I am using lame for transcoding for one of my project. The issue is that when I call lame from C#, a DOS window pops out. Is there any way I can suppress this?
Here is my code so far:
Process converter =
Process.Start(lameExePath, "-V2 \"" + waveFile + "\" \"" + mp3File + "\"");
converter.WaitForExit();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你有没有尝试过类似的事情:
Did you try something like:
假设您通过
Process.Start
,您可以使用采用ProcessStartInfo
具有其CreateNoWindow
属性设置为true
及其UseShellExecute
设置为 <代码>假。ProcessStartInfo
对象也可以通过Process.StartInfo
属性访问,并且可以在启动进程之前直接设置(如果要设置的属性数量较少,则更容易) 。Assuming you are calling it via
Process.Start
, you can use the overload that takesProcessStartInfo
that has itsCreateNoWindow
property set totrue
and itsUseShellExecute
set tofalse
.The
ProcessStartInfo
object can also be accessed via theProcess.StartInfo
property and can be set there directly before starting the process (easier if you have a small number of properties to setup).是另一种方式。
Is another way.
这是我的代码,它执行类似的操作(并且还读取输出和返回代码)
This is my code that does a similar thing, (and also reads the output and return code)