Skip to content
⌘ NSIS Forum Archive

uninstaller doesn't self-delete

4 posts

yuriythebest#

uninstaller doesn't self-delete

right, I've been doing the basic tutorials, and apart from the very first time the uninstaller won't self delete. I've tried checking my code and also pasting the exact code but that didn't help.

for instance this code:

# define installer name
outFile "installer.exe"

# set desktop as install directory
installDir $DESKTOP

# default section start
section

# define output path
setOutPath $INSTDIR

# specify file to go in output path
file test.txt

# define uninstaller name
writeUninstaller $INSTDIR\uninstaller.exe

# default section end
sectionEnd

# create a section to define what the uninstaller does.
# the section will always be named "Uninstall"
section "Uninstall"

# now delete installed file
delete $INSTDIR\test.txt

# and the uninstaller
delete $INSTDIR\uninstaller.exe

RmDir $INSTDIR

sectionEnd
it does remove the test.txt file afterwards, but uninstall.exe remains.



also, is notepad the only way to edit these scripts or is there a better editor that can highlight the keywords, etc?
fabian.rap.more#
Well how can you delete a file that is currenly executing? It will automatically be deleted the next time Windows starts but if you need to delete it then and there I think there is a how to in the wiki..
kichik#
The uninstaller respawns itself so this won't happen. Also, if you don't use Delete /REBOOTOK, deletion will just fail instead of being queued for reboot.