即使在ProcessWindowStyle.Hidden之后,控制台窗口仍会弹出。

编程入门 行业动态 更新时间:2024-10-09 06:23:02
本文介绍了即使在ProcessWindowStyle.Hidden之后,控制台窗口仍会弹出。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我必须从Windows应用程序中运行控制台应用程序。我要运行的控制台应用程序是我应用程序中的嵌入式资源,我这样称呼它:

I have to run a console application from my Windows Application. The console application I want to run is an Embedded Resource in my application, and I am calling it like this:

// Run the updater and grab its output Process Updater = new Process(); Updater.StartInfo.FileName = "C:\\tmp\\tmp.exe"; Updater.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; Updater.StartInfo.UseShellExecute = false; Updater.StartInfo.RedirectStandardOutput = true; Updater.Start(); string UpdaterOutput = Updater.StandardOutput.ReadToEnd(); Updater.WaitForExit();

它提取得很好,它运行得很好,而且它的输出也非常好...但是我仍然可以看到控制台窗口在运行时迅速弹出。我知道控制台是从此应用程序弹出的,因为控制台标题为 C:\tmp\tmp.exe 。有什么完全失败的方法可以隐藏控制台应用程序?我认为使用 ProcessWindowStyle.Hidden 可以做到,但显然不能。

It extracts fine, and it runs fine, and it also grabs its output completely fine... but I can still see the console Window popping open quickly as it's run. I know the console pop up is from this application because the console title is C:\tmp\tmp.exe. Is there any completely fail proof way to hide the console application? I thought using ProcessWindowStyle.Hidden would do it but apparently not.

谢谢。

推荐答案

设置 ProcessStartInfo.CreateNoWindow 属性设置为 true

更多推荐

即使在ProcessWindowStyle.Hidden之后,控制台窗口仍会弹出。

本文发布于:2023-11-28 01:04:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640352.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:弹出   控制台   仍会   窗口   ProcessWindowStyle

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!