如何以编程方式安排任务在关闭 Windows 时运行?
这与如何安排任务几乎相同关闭窗口时运行的任务,除非我需要以编程方式执行此操作。另外,我需要保证当脚本运行时,没有应用程序可以再取消关闭。
这可能吗?
谢谢。
更新,有一点背景:我的公司开发了一种防病毒程序,旨在保护网上银行客户。当然,该程序是恶意软件的常见目标,因此它需要保护自己不被卸载。它做的第一件事就是将自己注入到系统进程中,这样它就不会在不带上整个系统的情况下被杀死。
卸载此类程序的典型方法之一是将其标记为在下次关闭时删除,因此我们的应用程序会主动监视处理这些推迟删除的注册表项并将其删除。
我最近的任务是为我们的应用程序编写一个卸载程序(哦,讽刺的是)。当然,卸载程序必须删除文件,因此它必须解决我们自己构建的所有内容。它必须与旧版本兼容,因此更改保护机制不是一个选择。
This is almost the same as How to schedule a task to run when shutting down windows, except I need to do it programmatically. Also, I need the guarantee that when the script is run, no application can cancel the shutdown anymore.
Is this possible?
Thanks.
Update, with a little context: My company develops a sort of an antivirus program, designed to protect internet banking costumers. Naturally, this program is a frequent target of malware, so it needs to defend itself against being uninstalled. The first thing it does is inject itself into a system process, so that it can't be killed without bringing the whole system with it.
One of the typical ways of uninstalling such a program would be marking it for removal at the next shutdown, so our app actively monitors the registry keys which handle these postponed deletes and removes them.
I have recently been tasked with writing - oh the irony - an uninstaller for our app. The uninstaller must, of course, delete the files, so it has to work around everything we ourselves have built. It must be compatible with legacy versions, so changing the protection mechanisms is not an option.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您需要支持无法添加后门以供将来使用的旧版本,因此您可能必须将计算机启动到替代操作系统,以便您的文件不会在启动时加载,然后您可以安全地删除它们。考虑将免费软件第三方 DOS 克隆甚至小型 Linux 版本合并到卸载过程中。
Since you need to support legacy versions that have no option of adding a backdoor for future use, you will likely have to boot the machine into an alternative OS so your files do not get loaded at bootup, then you can delete them safely. Look into incorporating a freeware third-party DOS clone, or even a small Linux version, into your uninstall process.