Reputation: 31
I have an application to pack into a setup file with Inno setup. Application must work as a service on Windows. I am using NSSM service manager to get it done in single computer. However in Inno setup package, I couldn't find any trick to make it possible.
Is there anything to do it with NSSM or is it possible to make service working with Inno script?
Upvotes: 3
Views: 2171
Reputation: 145
Zip
file, then copy nssm.exe
to your source path (which Inno Setup script get sources from).Create a bat file to allow nssm
set your App as a service as below:
nssm install "ServiceName" "YourAPP.EXE"
nssm set "ServiceName" AppDirectory %CD%
nssm start "ServiceName"
del "%~f0"
Note: del "%~f0"
to delete bat file after setup finished, if you don't want that, remove that line from bat file
Add the previous bat file in your source path.
Add new sources to Inno Setup script as below:
[Files]
Source: "..\YOUR-SOURCE-PATH\file.bat"; DestDir: "{app}";
Source: "..\YOUR-SOURCE-PATH\nssm.exe"; DestDir: "{app}";
Add bat file under [Run]
section to set service and start your app as below:
Filename: "{app}\file.bat"; \
Flags: nowait postinstall hidewizard runhidden runascurrentuser; \
Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"
I hope it be useful, have to thank @MartinPrikryl
Upvotes: 4