I accidentally removed my Apache windows service trying to install another Apache web server. Does anyone know how I can create another Apache windows service from cmd? I tried "sc create ..." but I am missing a script on the end like -k start? Not sure what I need for the end of it...

I am running Apache 2.2

Thank you

link|improve this question
feedback

2 Answers

You can put the arguments for the service on the "binPath" argument on your "sc" command, escaping any quotes with slashes. For example, if you wanted to run: "C:\Program Files\foo\bar.exe" -service

sc create service_name binpath= "\"C:\Program Files\foo\bar.exe\" -service"

Look at the resulting service entry in HKLM\System\CurrentControlSet\Services\service_name and see if the ImagePath value looks like you want it to.

link|improve this answer
thank you for your reply. it gave me an error saying it could not be started in time. Error code 1? – Jared Oct 23 '09 at 20:09
feedback

The Apache2.2 service can be re-created with the "bin\httpd.exe -k install" command. Then started with the "bin\httpd.exe -k start" command.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown