1

I am creating a user defined service on Windows Xp using sc.exe To create I started with

sc.exe create "My Service" binPath= "D:\Service.bat"

Got a message CreateService SUCCESS.

Then I entered services.msc in the RUN and found the service which I created was there

Right clicked My Service then properties and when I started

I get an error as

ERROR 1053: The service did not respond to the start in a timely fashion

How do I fix this error.

Thanks

jeb
  • 78,592
  • 17
  • 171
  • 225
vels
  • 103
  • 1
  • 8
  • 1
    It could be a problem, that you try to add a batch file as a service. I suppose this isn't possible – jeb Oct 12 '11 at 07:58

1 Answers1

3

I think you need to enter cmd as command;

sc.exe create "My Service" binPath= "cmd /c D:\Service.bat"

And make sure the batch file does not stop too quick. At the first line of the batchfile let it write to a logfile, so you can see it is being executed. (and use a location where the service user may write to).

echo starting at %date% %time% > d:\service.log

As an alternative you can also use srvany.exe, see KB137890, but that is more hassle.

wimh
  • 15,072
  • 6
  • 47
  • 98