views:

191

answers:

1

Hi, I have a windows NT service (Maths.exe) created in VC++ 6.0. I don't have the source code or Visual studio 6.0 installed on my machine. Can anyone please let me know the command using which I can install the service in Service Control Manager (invoked using service.msc). I want to control (start, stop) the service manually.

Thanks in advance.

+1  A: 

To install a service, you can use the sc utility. The steps are:

  • Copy the executable and all its dependencies into a directory (%SYSTEMROOT%\System32 is perfectly valid).
  • Run as administrator of the computer the command:

sc create MathsService binPath= %SYSTEMROOT%\System32\Maths.exe type= own type= interact start= demand DisplayName= "My fabulous Maths service"

Where MathsService is the name of the service, the argument to binPath is the binary location and DisplayName argument is the name that shows on services.msc. The argument to start can be boot (not suitable for a service), system (not suitable for a service), auto (autostart), demand (on demand start, you have to start your service manually) or disabled (service will not start even manually).

In this example, i use type= own type= interact. This allows the service to interact with the desktop (for TCP/IP communications, for example).

Complete reference of sc sintaxis is available running sc. Also check http://support.microsoft.com/kb/251192

jrbjazz