[英]Inno Setup: Deleting folders after restart during uninstallation
I have a question about deleting folders during uninstallation using Inno Setup.我有一个关于在使用 Inno Setup 卸载期间删除文件夹的问题。
In my script, I use the uninsrestartdelete
flag on some files and call DelTree
on the {app}
folder on the last step of uninstallation.在我的脚本中,我在某些文件上使用uninsrestartdelete
标志,并在卸载的最后一步调用{app}
文件夹上的DelTree
。 Sometimes, I can't delete all files until system restart (those are code injection DLLs).有时,在系统重新启动之前我无法删除所有文件(那些是代码注入 DLL)。 In this situation, I can't delete the {app}
folder successfully.在这种情况下,我无法成功删除{app}
文件夹。 What's the correct way to delete the {app}
folder on system restart as well?在系统重新启动时删除{app}
文件夹的正确方法是什么? I can make sure there is no file left in the folder When I try to delete it.当我尝试删除它时,我可以确保文件夹中没有文件。
To schedule file or directory deletion on restart, call RestartReplace
function with DestFile
(second) argument set to an empty string ( ''
).要在重新启动时安排文件或目录删除,请调用RestartReplace
function并将DestFile
(第二个)参数设置为空字符串( ''
)。
RestartReplace(FileToDelete, '');
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.因此,您必须首先为目录中的所有文件调用RestartReplace
,这些文件无法删除。
For details, refer to WinAPI function MoveFileEx
and its MOVEFILE_DELAY_UNTIL_REBOOT
flag, which is behind the Inno Setup RestartReplace
function.详情参考WinAPI function MoveFileEx
及其MOVEFILE_DELAY_UNTIL_REBOOT
标志,它在 Inno Setup RestartReplace
后面 ZC1C425268E68385D1AB50741C1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.