2

During uninstall process Inno Setup uninstaller will create a folder named iu-....tmp in AppData\Local\Temp path. According to documentation it should be deleted while restarting the laptop, but I have noticed that it is not deleted.

I have tried to delete the folder in event function DeinitializeUninstall() using DelTree() also.

Thanks in advance for those who are helping me to solve this.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992

1 Answers1

1

I believe, Inno Setup schedules the temporary folder to be deleted using WinAPI function MoveFileEx and its MOVEFILE_DELAY_UNTIL_REBOOT flag. And that works only if you run the installer as Administrator. Are you? If not, the folder indeed stays. I do not think it's a problem, as Windows will cleanup old folders from the temp folder on its own eventually.


Calling DelTree from the uninstaller code cannot work. If it were that easy, the uninstaller would do it. The FAQ you refer to yourself explains why:

The reason the file remains in the directory after the uninstall process has completed is that Windows does not allow running executables to delete themselves.


If you really want to solve it, what you can do is to run a new process that will try to delete the folder on the background, once the uninstaller exits. Simple cmd process with delayed (and possibly retrying) del command would do. For such solution see a similar question:
Unload a .NET DLL from an unmanaged process

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992