|
|
|
|
#1 |
|
Member
Join Date: Jul 2015
Posts: 62
|
Problem deleting exe
Hi Folks,
So I have an NSIS installer(no uninstall section), I should probably call it an uninstaller as all it does is delete files and removes some registry entries. I am basically using NSIS to delete a product that is installed in some other technology. Everything works fine but I am not able to delete the exe itself that am running. My installer gets called from the registry key, HKLM\Microsoft\windows\CurrentVersion\Uninstall\[Some_Dir]\uninstall.exe Is there any switch I can add in the registry string, something similar to ExecWait to delete the exe itself after it has run? |
|
|
|
|
|
#2 |
|
Member
Join Date: May 2007
Location: Orange County, CA, U.S.A.
Posts: 73
|
3 options I can think of:
1. You could be content with the /REBOOTOK switch for Delete and RMDir, and let Windows automatically delete the file and folder after the next reboot. 2. You could change your logic to make an uninstaller without an installer instead. When in uninstall mode, NSIS automatically copies itself into a temporary folder, runs the copy and terminates the original process. This link will give you the right idea, even though it's creating an uninstaller on its own for a different reason (i.e., so that the uninstaller can be digitally signed). 3. You could also replicate the behavior of #2 in your installer. Assuming you're using LogicLib.nsh you could add something like this to the start of your .onInit function [not tested], e.g.: code: Then delete the temporary copy on reboot by adding the following to your .onGUIEnd function if you're not using ModernUI, or to your MUI_CUSTOMFUNCTION_GUIEND defined function if you are; or alternatively to both .onInstSuccess and .onInstFailed: code: |
|
|
|
|
|
#3 |
|
Member
Join Date: Jul 2015
Posts: 62
|
Thanks buddy for the reply! I will test out the scenarios you mentioned and see how it goes.
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|