How do I mark a directory to be deleted after reboot?

孤人 提交于 2019-12-24 16:01:28

问题


I've got an uninstaller that performs some actions and then prompts the user to reboot. I'd like a directory to be deleted after the reboot takes place. I know there's a way to do this, I'm just not sure how.

I'm using a WiX installer, and I'd imagine I could use that to do so, somehow, but I'm open to alternatives (whatever's simplest is just fine with me). My target platform is Windows 7, though it would be nice if this worked with older versions of Windows as well.

What's the simplest way to mark this directory for deletion after a reboot?


回答1:


If you have a locked file condition Windows Installer can handle the deletion after the reboot but there is no built-in way of instructing it to only delete it after a reboot. I think the only way you could do it would be to use a custom action to record a RunOnce registry entry that instructs it to do the delete. You can't use the Registry table for this as Windows Installer has no way of recording to the registry as part of an uninstall.

Still, you are coloring outside the lines on this one so I'd want to understand the why of this requirement in determining if it's valid.




回答2:


Try using SysInternal's "MoveFile". Specify "" as the target and poof! Assuming you don't end up in permission hell... :(



来源:https://stackoverflow.com/questions/3773374/how-do-i-mark-a-directory-to-be-deleted-after-reboot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!