Is there any quick way to, given an executable file, create a Windows service that, when started, launches it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To create a Windows Service from an executable, you can use
sc.exe:You must have quotation marks around the actual
exepath, and a space after thebinPath=.More information on the
sccommand can be found in Microsoft KB251192.Note that it will not work for just any executable: the executable must be a Windows Service (i.e. implement ServiceMain). When registering a non-service executable as a service, you’ll get the following error upon trying to start the service:
There are tools that can create a Windows Service from arbitrary, non-service executables, see the other answers for examples of such tools.