Create Windows service

Sc.exe also allows you to call any of the service control API functions and vary any of the parameters from the command line. The advantage to this is that it provides a convenient way to create or configure the service information in the registry and the Service Control Manager database.

sc.exe [Servername] Command Servicename [Optionname= Optionvalue...]

© https://support.microsoft.com/en-us/kb/251192