不启动控制台的.Net 控制台应用程序
我有一个控制台应用程序,用于通过 Windows 调度程序运行计划的作业。 与应用程序之间的所有通信均通过电子邮件、事件日志记录和数据库日志进行。 有什么办法可以抑制控制台窗口的出现吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我有一个控制台应用程序,用于通过 Windows 调度程序运行计划的作业。 与应用程序之间的所有通信均通过电子邮件、事件日志记录和数据库日志进行。 有什么办法可以抑制控制台窗口的出现吗?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(6)
当然。 将其构建为 winforms 应用程序,并且从不显示您的表单。
请小心,因为那样它就不再是真正的控制台应用程序,并且在某些环境中您将无法使用它。
Sure. Build it as a winforms app and never show your form.
Just be careful, because then it's not really a console app anymore, and there are some environments where you won't be able to use it.
借自 MSDN(链接文本):
Borrowed from MSDN (link text):
这是一个黑客,但以下博客文章描述了如何隐藏控制台窗口:
http://expsharing.blogspot.com/2008/03/hideshow-console-window-in-net-black.html
It's a hack, but the following blog post describes how you can hide the console window:
http://expsharing.blogspot.com/2008/03/hideshow-console-window-in-net-black.html
安排任务以与您的帐户不同的用户身份运行,这样您就不会弹出窗口。 。 。
Schedule the task to run as a different user than your account and you won't get a window popping up . . .
只需将计划任务配置为“无论用户是否登录都运行”。
Simply configure the Scheduled Task as "Run whether user is logged on or not".
为什么不将应用程序设为 Windows 服务?
Why don't you make the application a Windows Service?