Maiken Roskilde
Maiken Roskilde

Reputation: 467

Why does service quit after setup has been finalized

I am installing a certain using Inno Setup:

[Run]
Filename: "sc.exe"; Parameters: "create srvname start= auto DisplayName= mysrv binPath= {app}\mybinary.exe" ; Flags: runhidden

It works great, and my service is installed, but as soon as the setup is finished, the service is shutdown. It is still visible in the task manager, but no longer active.

It only starts again after a reboot. My setup does not require a reboot.

Does anybody know why this is so and how I can keep the service alive after setup execution?

Thank you!

Upvotes: 0

Views: 26

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202340

Your sc command creates a service, it does not start it. So it behaves correctly. Just try the same command on command-line.

In other words, the service does not quit, it does not even start.

If you want to start the service, run sc.exe start srvname after installing the service.

[Run]
Filename: "sc.exe"; \
    Parameters: "create srvname start= auto DisplayName= mysrv binPath= {app}\mybinary.exe"; \
    Flags: runhidden
Filename: "sc.exe"; \
    Parameters: "start srvname"; \
    Flags: runhidden

Upvotes: 1

Related Questions