This article goes over how to create a windows service.
I will be going over 3 different ways to create a windows service. Check the legend to skip to the method you’d like to use. They will be: PowerShell, 3rd Party Tool, and Windows Resource Kits.
Microsoft Source Article with ALL Syntax - Microsoft Link
TestService Example:New-Service -Name "TestService" -BinaryPathName "C:\WINDOWS\System32\svchost.exe -k netsvcs"
https://github.com/winsw/winsw is the project that is a fantastic wrapper for windows services.
You will download this exe and rename it to your needs. It is configured by the included XML file under the same name.
http://nssm.cc is the official site for this 3rd party tool method.
To show service installation GUI:nssm install [<servicename>]
To install a service without confirmation:nssm install <servicename> <app> [<args> ...]
To show service editing GUI:nssm edit <servicename>
To retrieve or edit service parameters directly:nssm get <servicename> <parameter> [<subparameter>]
nssm set <servicename> <parameter> [<subparameter>] <value>
nssm reset <servicename> <parameter> [<subparameter>]
To show service removal GUI:nssm remove [<servicename>]
To remove a service without confirmation:nssm remove <servicename> confirm
"C:\Program Files\Windows Resource Kits\Tools\instsrv.exe" "New Service" "C:\Program Files\Windows Resource Kits\Tools\srvany.exe"
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\New Service
C:\MQ2\eqbcs.exe
services.msc
Automatic
Each one of these ways have their uses and I have used each method for different programs. It is great to learn to use all of the above examples or at least make yourself familiar with them.