Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Windows Server 2008: Trouble running batch file as service

Posted on 2014-01-14
1
Medium Priority
?
4,524 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 85

Accepted Solution

by:
oBdA earned 2000 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

609 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