Sign in to follow this  
Followers 0
Popcorned1

Run a program as a Service

21 posts in this topic

How to Run a Program as a System Service!

Step 1 : Download and install srvtools.zip, this can be downloaded from the Microsoft website HERE

Step 2 : Once installed find the two files named as follows : instrv.exe and srvany.exe and copy them to the folder where the exe lies for the program you want to make a service.

Step 3 : Open up the command prompt and type in the following. For the example I'm using a folder called "example" :

cd "C:\example\"

This puts command prompt into the folder where your program lies.
instsrv Servicename"C:\example\srvany.exe"
This installs the program as the service. Yes! Replace Servicename with your own service name. Some registry editing to go and then were done.
REGEDIT4


[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Servicename\Parameters]

"Application"="\"C:\\example\\example.exe\""

Save as a *.reg file and simply double click to run it.

You can also see you need to replace the Servicename and the directory with the service name and your program folder you made earlier.

C & C's welcome.

Edited by Popcorned

Share this post


Link to post
Share on other sites

how does running a program as a service benefit? i am curious and am sure that others are too. also, will it show up in services under admin tools?

Share this post


Link to post
Share on other sites

Yes, it shows in the service panel so you can also allow it to interact with the desktop. The advantage of this is that the program is going to run on system boot. So if you need a software to run for some reason without stopping this can do it. I don't know exactly why you want to do this, but I think it's helpfull for those times when you might need it.

Share this post


Link to post
Share on other sites

Running an app as a service is especially helpful on servers, where a program may need to run even if no users have an active session.

Share this post


Link to post
Share on other sites

Nice one I think just about every programmer asks this question at one time or another

Edit> This first 'HERE' link doesn't do anything

Share this post


Link to post
Share on other sites

That's wrong Shooter, updated the original topic with the link.

Cheers! :D

Share this post


Link to post
Share on other sites

i found INSTSRV.EXE and SRVANY.EXE here:

http://www.electrasoft.com/srvany/srvany.htm

i put the two files inside the Winpooch folder and created two files:

WP_Service.cmd

instsrv Winpooch "D:\Program Files\Winpooch-0.5.10\srvany.exe"
WP_Service.reg
Windows Registry Editor Version 5.00


[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Winpooch\Parameters]

"Application"="\"D:\\Program Files\\Winpooch-0.5.10\\Winpooch.exe\""

and ran them in that order. I do have a Winpooch entry in Services.msc and I see it in Autoruns, but it doesnt work when i try to start it. :(

Edited by DigeratiPrime

Share this post


Link to post
Share on other sites

Might be you don't have it set ti allow to interact with desktop, so you see no windows.

I use this method to run Hamachi all the time from system boot, very handy. I have also set it up to run command prompt, so if I ever need anything, I can get a command prompt running as system, which allows me to reset permissons and stuff, if I ever bork them up. Also, if you want to live really dangerously, you can use this command prompt to run any other app (like IE if you feel brave) as System.

Share this post


Link to post
Share on other sites

Lets have a looksy, oh look a error

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Servicename\Parameters]

"Application"="\"D:\\Program Files\\Winpooch-0.5.10\\Winpooch.exe\""

Replace that with Winpooch

Try now.

Share this post


Link to post
Share on other sites

its working! :)

Share this post


Link to post
Share on other sites

woot thanks for the guide!

Share this post


Link to post
Share on other sites

Will be helpful for my FTP Server. Thanks a lot for a great guide.

Share this post


Link to post
Share on other sites

Firstly Hi all...great forums :)

Thanks for the guide but I seem to be having some probs.

I am trying to have Speedfan as a service and just cant seem to get it going.I have followed the instructions given,replacing servicename and directory etc.

Speedfan wont even show up in services.

Any idea what Im doing wrong?

the directory is D:\Program Files\Speedfan and I was going to call the service simply Speedfan.

I began as follows...

cd "D:\Program Files\Speedfan\"

then followed with....

instsrv Speedfan"D:\Program Files\Speedfan\srvany.exe"

with which Ii get this......

Installs and removes system services from NT

INSTSRV <service name> (<exe location> | REMOVE)

[-a <Account Name>] [-p <Account Password>]

Install service example:

INSTSRV MyService C:\MyDir\DiskService.Exe

-OR-

INSTSRV MyService C:\mailsrv\mailsrv.exe -a MYDOMAIN\joebob -p foo

Remove service example:

INSTSRV MyService REMOVE

This is my reg file...

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Speedfan\Parameters]

"Application"="\"D:\\Program Files\\Speedfan\\speedfan.exe\""

Any help much appreciated.

Thanks,

Ray

Share this post


Link to post
Share on other sites

Man, it's hard to find a error in that but I think I may have got you a answer. Look below.

instsrv Speedfan"D:\Program Files\Speedfan\srvany.exe"

Closely look at this

Speedfan"D:\
You can see there is no space between
fan
and
"D:\
Add a space and you get
instsrv Speedfan "D:\Program Files\Speedfan\srvany.exe"

Should and better work!

Nope, sorry mate. I've downloaded and tried and tested it myself. It's something with the program because i did it with another program just now and everything goes as planned. Sorry :(

Share this post


Link to post
Share on other sites

I keep getting an error something about the service did not respond in a timely manor

Share this post


Link to post
Share on other sites

ok thanks popcorned :)

was worth a try :yes:

Share this post


Link to post
Share on other sites

Is it possible to use this method to run a perl script as a service?

Share this post


Link to post
Share on other sites

Or you could just download this. Works very well and is extremly easy to use.

Share this post


Link to post
Share on other sites

how does running a program as a service benefit? i am curious and am sure that others are too. also, will it show up in services under admin tools?

See apache, for example...

Its really boring that black screen :p

You run as a service and its one program less on your taskbar lol

This is the benefit I know :p

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.