• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 39533
  • Last Modified:

make a service with sc.exe

Can someone show me WORKING SAMPLE SYNTAX to turn a exe into a service with the sc.exe utility?

I turned a batch file into a exe with a bat2exec utility, but no dice on getting it to run as a service.

::simple bat contents
goto again

:: trying to create it so the DOS window is always showing:
C:\>sc create newservice binpath= c:\windows\again.exe type= interact start= auto obj= %computername%\user password= abc-123
[SC] CreateService FAILED 87:

:: trying again using MS's own sample syntax...
c:\>sc create newservice2 binpath= c:\windows\again.exe
[SC] CreateService2 SUCCESS

c:\>net start newservice2
System error 5 has occurred.

Access is denied.


::fine, I'll be more explicit:
c:\>sc create newservice3 binpath= c:\windows\again.exe type= share start= auto obj= user password= abc-123
[SC] CreateService3 SUCCESS

c:\>net start newservice3
System error 1069 has occurred.

The service did not start due to a logon failure.


I give up.

1 Solution
it all depends on how your again.exe is coded...

I recomend this way (easyest) http://www.softplatz.com/Soft/Utilities/Other/Exe-To-Service.html
but if you want I have instructions for register a exe under a service. A little easy job also.

I think you are confused about the capabilities of sc.exe. The create option will add a service to the registry. It doesn't take a non-service structured exe and turn it into a service.

This page isn't real clear on this. Your one clue is:

Creates a service (adds it to the registry).


If you can get your hands on Visual Studio for .NET Version 1+ creating a service is a no brainer.
You can use SrvAny.exe and InstSrv.exe from the W2k3 Resource Kit Tools to let a batch file run as a service; install the Resource Kit Tools and check the help for details:
Windows Server 2003 Resource Kit Tools
Chris GralikeSpecialistCommented:
Also with the
type= interactive declaration you still need the scope ie.

type= interactive type= own, would actually work

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now