How to turn an executable-file into a service in Windows 7?

1

1

I want to use an executable-file (which sports only a command-line interface) as a service in Windows 7.

I added it to successfully via:

sc MySVC binPath= "C:\Windows\System32\MyProgram.exe"

but once I try to start it, it times out with an 1053 error.

What am I doing wrong?

Hedge

Posted 2011-05-29T19:23:35.797

Reputation: 1 044

Should this be sc CREATE MySVC binPath=...? – mwfearnley – 2020-02-21T10:43:49.637

Answers

1

Perhaps you could look at Servify This

Should do what you;re asking for.

Joe Taylor

Posted 2011-05-29T19:23:35.797

Reputation: 11 533

That does the trick perfectly <3 – Hedge – 2011-05-29T20:06:32.850

1

I use three methods:

1.- SC command, just related above.
2.- SrvAny from Windows Resource Kit.
3.- AlwaysUp (not free :-( ). The best until now.

In order to not repeat posts, here are the details:

Sopalajo de Arrierez

Posted 2011-05-29T19:23:35.797

Reputation: 5 328

0

You said "Sports only a command-line interface", this makes no difference what so ever, a service can be run as a command line or a GUI (limits/security depending).

I would personally take a look at the application closer, if it is logging in as a user (service for example) does it have the needed paths and/or are you giving all the necessary calls/arguments in the start?

William Hilsum

Posted 2011-05-29T19:23:35.797

Reputation: 111 572

I found out the problem was that Windows didn't get any response from it (it awaits a special response from services). So I had to wrap it with a tool like Servify This which makes the necessary calls for me. – Hedge – 2011-05-29T20:08:37.780

0

If the program you're trying to run as a service requires user input, that may be what's causing it to time out. Try executing the program from the command line with the exact same flags and switches you've got the service configured to run with and see what happens. You may need additional flags/switches to make it run without user input whatsoever, or pipe input in from another program/file through a scripted call to the program (batch file, powershell script, etc).

Matrix Mole

Posted 2011-05-29T19:23:35.797

Reputation: 3 303

It doesn't need user input. – Hedge – 2011-05-29T20:12:33.863

0

Have a look at NSSM - "the Non-Sucking Service Manager".

NSSM is created exactly for this purpose, and also for monitoring & auto-restarting such a console app. It's used e.g. by SaltStack, and others.

It's licensed as a public domain app.

akavel

Posted 2011-05-29T19:23:35.797

Reputation: 696