0

I'm trying to run my batch file(run.bat) as a windows service using Service controller

This is the command I used to create my Service

sc \\myservername create myservicename binPath="C:\Program Files\Directories to use\ANI\run.bat" start=auto

[SC] CreateService SUCCESS

When I run my service:

sc start ANIService
[SC] StartService Failed 1053:
The service did not respond to the start or control request in the timely fashion
Rose
  • 1,490
  • 5
  • 25
  • 56
  • If you replace `"C:\Program Files\Directories to use\ANI\run.bat"` with a batch file that just prints `echo %1` do you get the same error? If not, your problem is with `"C:\Program Files\Directories to use\ANI\run.bat"`. – LinuxDisciple Nov 22 '16 at 00:01
  • @LinuxDisciple: no, the whole idea is wrong. A service is an executable that implements a particular interface, you can't just tell the operating system that a batch file is a service and expect it to work. (The batch file might or might not run, but because it doesn't call StartServiceCtrlDispatcher, you'll still get the "did not respond" error either way.) – Harry Johnston Nov 23 '16 at 01:49

1 Answers1

0

Try to use NSSM, this should work fine.

user2956477
  • 1,208
  • 9
  • 17