Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

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.

share|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

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.