Create service with NSIS

Sheldon Livingston
Sheldon Livingston used Ask the Experts™
on
Trying to create a service from NSIS using:

nsExec::Exec '"cmd.exe SC create ServiceName binpath= c:\Promgram.exe"'

or

nsExec::Exec '"cmd.exe SC create ServiceName binpath= c:\Program.exe"'

Is it possible to create a service with NSIS?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chinmay PatelChief Technology Ninja
Distinguished Expert 2018

Commented:
Hi Sheldon,

Just to be clear, you want to install OR create a Windows Service?

Regards,
Chinmay.
Sheldon LivingstonConsultant

Author

Commented:
I have a program that I wish to create a service from.  I can go into dos and type:

sc create servicename pathToProgram

I want to be able to have NSIS run the "sc create servicename pathToProgram" line.
Chief Technology Ninja
Distinguished Expert 2018
Commented:
Please have a look at this plugin ExecDosfrom: https://nsis.sourceforge.io/ExecDos_plug-in

Once you install it:
ExecDos::exec /TIMEOUT=4000 "sc create servicename pathToProgram" 

Open in new window

Sheldon LivingstonConsultant

Author

Commented:
Thank you!
Chinmay PatelChief Technology Ninja
Distinguished Expert 2018

Commented:
You are welcome :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial