C# – Install a Windows service using a Windows command prompt

ccommand-promptwindows-services

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

How do I do this?

Best Answer

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"