Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> You can put the batch script in %TEMP% and hope something will clean it up, or if you're feeling extra nice you can set up an action to get it cleaned up at next boot.

If you can set an action to get something deleted at next boot why not use that to delete your uninstaller itself, rather than adding an extra layer of indirection?



As far as I remember the thing you use to delete the file on next boot does not run arbitrary code, but is a special "rename-like" action that you can't use to recursively delete the folder of your program.

edit: https://learn.microsoft.com/en-us/windows/win32/api/winbase/...

It's the MOVEFILE_DELAY_UNTIL_REBOOT flag. Honestly maybe you can call MoveFileA on the entire directory tree you want to delete starting from the .exe and spare yourself the script, I don't see an obvious reason why it wouldn't work.


or why not just make the uninstaller a stub executable that copies the real executable into the temp folder and run that instead?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: