Follow the steps below in order to create a service:
-Run the Command Line as Admin
sc create ServiceName binpath= "full_exe_path"
for example if your service name will be ProcessService and the path of your exe is C:\Users\Username\Process.exe, then type:
sc create ProcessService binpath="C:\Users\Username\Process.exe"
Check the services to see if the service was created successfully.
To delete the service you can either use the command:
sc delete ServiceName
or delete the service in your registry:
Go to Start > Run > and type regedit
Navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services and delete the appropriate service folder.
A restart would be required.
Note that if the generated Process contains any interactive action, the service will not be able to run in the background when there is no user logged or when the desktop is locked.
Interactive actions include all actions under "UI/Windows" folder,"Mouse and Keyboard" actions, monitor related actions etc.
In case the Process has no interactive actions, then the compiled .exe can always run as a service.