Search code examples
windows-servicescommand-prompt

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?


Solution

  • 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"
    

    Regarding a comment, for 64bit apps, use below:

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe