Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install a Windows service using a Windows command prompt?

I want to install a Windows service using a Windows command prompt (not the Visual Studio command prompt).

How do I do this?

like image 483
Vikash Pandey Avatar asked Nov 17 '11 09:11

Vikash Pandey


People also ask

How do I run a Windows service?

Start and run the serviceIn Windows, open the Services desktop app. Press Windows+R to open the Run box, enter services. msc, and then press Enter or select OK.


2 Answers

Navigate to the installutil.exe in your .net folder (for .net 4 it's C:\Windows\Microsoft.NET\Framework\v4.0.30319 for example) and use it to install your service, like this:

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe" "c:\myservice.exe" 
like image 89
hcb Avatar answered Oct 08 '22 10:10

hcb


Nothing wrong with SC Create command. Just you need to know the correct args :

SC CREATE "MySVC" binpath= "D:\Me\Services\MySVC\MySVC.exe" 
like image 21
Sid Avatar answered Oct 08 '22 10:10

Sid