Archive: Weird behavior of ExecWait


Weird behavior of ExecWait
Hello,
The software Im installing using NSIS consists in windows services. When installing, once the files are copied I call the following and all works very well:

; Install the service
ExecWait "installutil MyService.exe"

; Start the service
ExecWait "net start $\"My Windows Service$\""

Then comes the time of uninstalling, I want the uninstaller to stop the service and remove it from the windows services. So I do the following:

ExecWait 'net stop $\"My Windows Service$\"'
Sleep 1000

; Uninstall the service
ExecWait "installutil MyService.exe /u"
Sleep 1000

Doing so, the service stops as expected. However, it does not get uniinstalled using installutil as expected. NSIS seems just to skip this step the service is never removed from the list of services installed in Windows.

Anyone got an idea why would this happen?
Thanks for your help,


1. If we are talking about .net\framework installutil.exe, you can also use one of DOS plug-ins, nsExec (included to NSIS package, program files\nsis\contrib\nsexec) or ExecDos, this allow to hide dos window.
2. If you don't see any output in the DOS window on ExecWait call, this means that executable not found. PATH env. var on my comp not includes framework folder, in uninstaller it is very usefull to set full path, for example
ExecWait "'$WINDIR\Microsoft.NET\Framework\v1.1.4322\installutil.exe' MyService.exe /u"
(or extract framework path from registry).


1. Thanks for the tip, it does look nicer and more professional without the DOS window.
I used nsExec::ExecToLog instead, now all the output of the execution is in the details instead, pretty nice :).

2. Using full paths, it worked well. Looks like you were right. What I had done is include the installutil.exe in the package so it could be called from the installation folder (wouldnt have to look for the .Net path). It works fine for installing the service, it just doesnt work when uninstalling (couldnt find the reason why).

nsExec::ExecToLog "installutil MyService.exe"
works all good

ExecWait "installutil MyService.exe /u"
wont work... So it looks like using the option "/u" screws up smtg and I couldnt figure out what.

Anyways, thanks for the tip I guess I will just retrieve the .NET framework path and do it the right way.

Regards,


I know that the tread is from a long time ago, but I had exactely the same problem SneakySly.
The reason for not working of ExecWait is following: The uninstaller is transparently copied to the system temporary directory for the uninstall.

Regards, DonChunior