Registering a service on a Windows machine with SC command is rather straightforward process, and you may use /? to familiarize yourself with switches etc.
There is only one issue which you may run into – most of binaries which are being registered as a services on Windows machines reside in “C:\Program Files” or “C:\Program Files (x86)” so you should pass binary path with quotes. If you just run something like this:
sc create MyService binpath= "C:\Program Files (x86)\My Service\myservice.exe" displayname= "My Service"
Service will be successfully registered, but you lose quotes in binpath in this case. In order to preserve quotes in binpath following syntax should be used:
sc create MyService binpath= "\"C:Program Files (x86)\My Service\myservice.exe\"" displayname= "My Service""
In order to have quotes for path you put inside of parameter quotes so called “escaped quotes”. I guess following picture makes it all clear:
Source: HugoRune‘s answer on StackExchange to question “creating a service with sc.exe; how to pass in context parameters”
Another hack or approach will be creating service as is, then adjusting parameters and/or binpath in respective section of registry: