We help IT Professionals succeed at work.
Get Started

Run a Batch File as a Service (troubleshooting)

IDPInc
IDPInc asked
on
570 Views
Last Modified: 2012-05-11
I've gone through the following steps to have a batch file run as a service:

1. get the "srvany.exe " from the "Windows Server 2003 Resource Kit Tools " and copy it to a suitable location on your Win2008 server (e.g. C:\Windows\System32\ ).
2.Use "sc " to create a new service that launches "srvany " (e.g. sc create MyService binPath= C:\Windows\System32\srvany.exe DisplayName= "My Custom Service" )
3.Using RegEdit : create a "Parameters " key for your service (e.g. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService\Paramaters\ )
4.Using RegEdit : within the newly created "Parameters " key , create a string value called "Application " and enter the full path to the application you are wanting to run as a service.  (No quotes required.)

I tried using instrv in place of srvany.

When I try to start the service I get the error "Service did not respond to the start or control request in a timely fashion"

I played with the settings in the registry to change the "Path to Executable" but still no joy.  

The event viewer wasn't very help ful and when I ran an SC query i received:

C:\>sc query csss4

SERVICE_NAME: csss4
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 1  STOPPED
                                (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN))

        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

Any ideas?
Comment
Watch Question
IT super hero
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE