Inno Setup:在卸载过程中重新启动后删除文件夹 [英] Inno Setup: Deleting folders after restart during uninstallation
问题描述
我有一个有关在使用Inno Setup卸载期间删除文件夹的问题.
I have a question about deleting folders during uninstallation using Inno Setup.
在我的脚本中,我对某些文件使用 uninsrestartdelete
标志,并在最后一步中调用 {app}
文件夹中的 DelTree
卸载.有时,我无法在系统重新启动之前删除所有文件(这些文件是代码注入DLL).在这种情况下,我无法成功删除 {app}
文件夹.在系统重启时删除 {app}
文件夹的正确方法是什么?尝试删除文件时,我可以确保文件夹中没有文件.
In my script, I use the uninsrestartdelete
flag on some files and call DelTree
on the {app}
folder on the last step of uninstallation. Sometimes, I can't delete all files until system restart (those are code injection DLLs). In this situation, I can't delete the {app}
folder successfully. What's the correct way to delete the {app}
folder on system restart as well? I can make sure there is no file left in the folder When I try to delete it.
推荐答案
要计划重新启动时删除文件或目录,请调用 RestartReplace
函数,其中 DestFile
(第二个)参数设置为空字符串(''
).
To schedule file or directory deletion on restart, call RestartReplace
function with DestFile
(second) argument set to an empty string (''
).
RestartReplace(FileToDelete, '');
对于目录,仅当它们为空时,此方法才有效.因此,您必须首先对目录中所有无法删除的文件调用 RestartReplace
.
For directories, this works, only if they are empty. So you will have to first call RestartReplace
for all files inside the directory, which cannot be deleted.
有关详细信息,请参考 WinAPI函数 MoveFileEx
及其 MOVEFILE_DELAY_UNTIL_REBOOT
标志,位于Inno Setup RestartReplace
函数的后面.
For details, refer to WinAPI function MoveFileEx
and its MOVEFILE_DELAY_UNTIL_REBOOT
flag, which is behind the Inno Setup RestartReplace
function.
这篇关于Inno Setup:在卸载过程中重新启动后删除文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!