Solved

Windows Server 2008: Trouble running batch file as service

Posted on 2014-01-14
1
4,099 Views
Last Modified: 2014-01-14
I need to run "C:\bat\runme.bat" in the background.  It is NOT

I tried this:
sc create customws binPath= "C:\custom\runme.bat" type= own

Open in new window


That successfully adds it to the list of webservices but when I click: "Start" I get an error:

Windows could not start the customws service on local computer.

Error 1053: The service did not respond to the start or control request in a timely fashion
0
Comment
Question by:hankknight
1 Comment
 
LVL 82

Accepted Solution

by:
oBdA earned 500 total points
ID: 39779471
sc.exe only creates the entry for the Service Manager, nothing more. It does not do any magical transformation of a batch file into a Windows service.
To run a program (in this case cmd.exe running a batch file) as a service that was not developed as a service, you need a wrapper that presents itself as a service and runs the program.
For W2k3, there was SrvAny.exe in the Resource Kit (http://www.microsoft.com/en-us/download/details.aspx?id=17657); it should still work on W2k8 (though only in 32bit) but the better solution is the "Non-Sucking Service Manager" from http://nssm.cc/
Download it and follow the instructions to let your batch file run as a service.
0

Featured Post

Integrate social media with email signatures

Is your company active on social media? Do you also use email signatures? Including social media icons in your email signature is a great way to get fans for free. Let all your email users know you’re on social media quickly and easily, in a single click.

Join & Write a Comment

Resolve DNS query failed errors for Exchange
OfficeMate Freezes on login or does not load after login credentials are input.
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now