每 15 分钟执行一次的简单应用程序。我怎样才能阻止它干扰任何Windows?
基本上,我有一个每 15 分钟运行一次的应用程序。我希望此控制台应用程序保持隐藏状态,而不是最小化/干扰全屏应用程序。
实现这一目标的最佳方法是什么,但它不能是一项服务。我正在用 C# 编写控制台应用程序。
谢谢。
Basically, I have an application that runs every 15 minutes. I would like this Console application to remain hidden and not for example minimise/disturb full screen applications.
What would be the best way to accomplish this, it can't be a service though. I'm writing the console application in C#.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
要每 15 分钟运行一次应用程序,请使用计划任务。避免显示任何窗口的非常简单的方法是使其成为普通的 GUI 应用程序而不是控制台应用程序,但安排您不在 GUI 应用程序中显示任何窗口。
To run an application every 15 minutes use a scheduled task. The very simple way to avoid any window being shown is to make this a normal GUI app rather than a console app, but arrange that you do not show any windows in your GUI app.
就像大卫说的,如果你让它成为一个 GUI 程序,但从不加载任何窗口,它将在后台运行,不会弹出或显示任何内容。另一个选择是让你的应用程序连续运行,并让它每 15 分钟执行一些操作...
like david said if you make it a gui program but never load any windows it will run in the background with nothing ever popping up or showing or anything.. another option would be to have your application run continuously and have it do something every 15 minutes...
一种选择是让计划任务以不同的用户身份运行,可能是网络服务,具体取决于您的需求。这将强制它在特定的用户上下文下运行,并且不会显示在其他登录用户的屏幕上。
One option would be to have the scheduled task run as a different user, Network Service maybe, depends on your needs. This will force it to run under the specificed users context and will not show up on other logged in users screens.
你不需要做任何事情。控制台应用程序是不可见的,并且不与其他窗口交互。知道它存在的唯一方法是通过任务管理器或类似的东西。
You don't need to do anything. A console application is invisible and doesn't interact with other windows. The only way to even know it's there is through Task Manager or something similar.