The bat bat file in Windows 7 does not start as a service

I start a Windows service that starts a simple bat file at startup, but the service does not start. If I try to start it manually from the service GUI, I get the following error message.

Error 1053: the service did not respond to a start or control request in a timely manner

This seems like a common mistake when starting the service, however I did not find a similar problem in the other answers. I created the service from the command line with the following command

C:\Users\Administrator>sc create service_name binpath= c:\service.bat start= auto [SC] CreateService SUCCESS 

Then I run it with

 C:\Users\Administrator>sc start service_name 

However, I received an error message:

[SC] StartService FAILED 5:

Access is denied.

If I run it from the command line as an administrator, I do not receive an access denied message, but I get error 1053. I believe that running a single bat file as a Windows service should not be so difficult. Any ideas?

+6
source share
1 answer

You get the first error, because your batch file cannot coordinate / interact with the Windows services subsystem. When Windows starts the service, the OS waits a few seconds for the service to report that it is running properly. If this signal never arrives (as in your batch file that knows nothing about the Services), Windows will report error # 1053.

You will need a wrapper application to run your batch file as a service. Microsoft's free "SRVANY" utility may work for you, but you should also explore more fully functional commercial alternatives.

+7
source

Source: https://habr.com/ru/post/906663/


All Articles