- NSIS Discussion
- How can I create an uninstaller?
Archive: How can I create an uninstaller?
Angry Coder
11th May 2006 04:01 UTC
How can I create an uninstaller?
Hi!
I am very new with NSIS. And I have a simple setup program that does the following:
- Create directory on My Programs and copy a single file
- Create a a shortcut on Startup folder
How can I create an uninstaller and place it under My Programs?
Thanks.
amckern
11th May 2006 04:05 UTC
I dont know how to do this, but...
For complex applactions
I would recomend you use the wizzard applaction called HM NIS Edit from http://hmne.sourceforge.net/
Just chose file>new script from wizzard and folow the prompts
JasonFriday13
11th May 2006 05:15 UTC
WriteUninstaller "$INSTDIR\uninstall.exe"
CreateShortCut "$SMPROGRAMS\Your Program Folder\Uninstall Your Program.lnk" "$INSTDIR\uninstall.exe"
amckern
11th May 2006 11:00 UTC
whoa, that simplie - dam NSIS is rather good
Angry Coder
11th May 2006 17:49 UTC
I got this error:
Error: no Uninstall section specified, but WriteUninstaller used 1 time(s)
Error - aborting creation process
Afrow UK
11th May 2006 18:02 UTC
Section Uninstall
Delete ...etc
SectionEnd
-Stu
Angry Coder
11th May 2006 23:45 UTC
Delete what? :(
JasonFriday13
12th May 2006 03:49 UTC
The uninstaller does not make a list of files and registry keys to delete when installing. You must delete the files manually in the uninstaller. You must also have some uninstaller pages, too.
UninstPage confirm
UninstPage instfiles
Section Uninstall
Delete "$INSTDIR\programfile1.txt"
Delete "$INSTDIR\programfile2.txt"
Delete "$INSTDIR\programfile3.txt"
Delete "$INSTDIR\programfile4.txt"
Delete "$INSTDIR\uninstall.exe"
RMDir "$INSTDIR"
SetAutoClose false
SectionEnd
Angry Coder
12th May 2006 03:56 UTC
Thanks but this is not working:
Section "Uninstall"
Delete "$INSTDIR\Uninstall My Program.exe"
Delete "$INSTDIR\My Program.exe"
RMDir $INSTDIR
Delete "$SMSTARTUP\My Program.lnk" <------- Everything is ok, except this line. It doesn't remove the shortcut!
SectionEnd
Please help. Thanks.
JasonFriday13
12th May 2006 04:51 UTC
Please don't double post. I have stated this on the other post you made.
I don't know why but it should work. This basic script works:
Name "Delete Startup File"
OutFile "Delete Startup File.exe"
InstallDir "$PROGRAMFILES\myapp"
Page directory
Page instfiles
UninstPage instfiles
Section
SetOutPath "$INSTDIR"
CreateShortCut "$SMSTARTUP\Uninstall this app.lnk" "$INSTDIR\uninstall.exe"
WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
Section Uninstall
Delete "$SMSTARTUP\Uninstall this app.lnk"
Delete "$INSTDIR\uninstall.exe"
RMDir "$INSTDIR"
SectionEnd
Angry Coder
12th May 2006 05:58 UTC
The following was missing:
SetShellVarContext all
:)
onad
12th May 2006 09:09 UTC
Hi AngryCoder,
IMHO I think you could benefit from trying the NSIS examples first, then look in the code and improve your installer script by borrowing example snippetes of code.