Start command-line application as service

0

I have a exe program and I would like to create a new service in a WinNT system. This program is a tiny command-line ftpserver.

I tried this command:

sc create testFtp binPath="c:\ftpdmin.exe" start=auto

This works for service creation but when I try to start it, I got a timeout. Maybe because this command-line is not really a deamon.

Is is any way to avoid this error and start a command-line application in background?

Tobia

Posted 2016-01-27T12:40:03.293

Reputation: 2 022

you probably want to use installutil.exe: https://msdn.microsoft.com/en-us/library/aa984379%28v=vs.71%29.aspx

I notice you have an NT4 tag. I don't believe that the sc.exe shipped with NT4 (I'm pretty sure it was an Win2k thing), but I must admit, its been 12 years since I touched an NT4 box.

– Frank Thomas – 2016-01-27T13:31:55.417

Unfortunately this is a CNC machine equiped with an old win NT4 OS. The very first problem is the obsolescence of this system. – Tobia – 2016-01-27T15:58:40.017

Answers

1

Your service fails to start (reporting error 1053) because your executable is not a real windows service and can not respond properly to the start-service request.

You will have to use a "service wrapper" -- go-between utility that can intercept the start/stop service calls and take the appropriate action with your application. Microsoft's free (and old) Srvany will do the basic job but there are other free and commercial options available as well.

CoreTech

Posted 2016-01-27T12:40:03.293

Reputation: 1 206