command line install program as service windows code example
Example 1: install windows service
SC CREATE "MySVC" binpath= "D:\Me\Services\MySVC\MySVC.exe"
Example 2: install windows service application on windows server
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe" "c:\myservice.exe"