Windows关闭期间运行进程 [英] Run process during windows shutdown

查看:123
本文介绍了Windows关闭期间运行进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Win32服务,该服务需要在服务停止时运行.NET可执行文件(出于清理的原因).我最近发现,清理永远不会在关闭时发生,因为进程创建会被OS阻止.有谁知道一种替代此方法的方法?过程中,我正在产卵不是侵入性的,应该只运行一秒钟的时间.

I have a Win32 service, that needs to run a .NET executable on service stop (for cleanup reasons). I recently discovered that the cleanup never happens on shutdown, because the process creation gets blocked by OS. Does anyone know a way to override this? Process, I am spawning is not invasive and should only run a fraction of a second.

推荐答案

我能找到的唯一方法是:预先创建一个挂起的子进程,然后在关闭时将其取消挂起.

The only way I could find to do it was: pre-create a child process suspended, and them un-suspend it on shutdown.

这篇关于Windows关闭期间运行进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆