Installation
Create the "install. bat" file and open the file with Notepad with the contents
C:\windows\microsoft.net\framework\v4.0.30319\InstallUtil.exe E:\program\vs2010\Test\TestWindowsService1\bin\ Debug\testwindowsservice1.exe
Save the file. The first half of the content is the service installer path for. NET4 (if other versions are developed, select the path of the appropriate version), and the second half is the service program path to be installed.
You can simply double-click the "Install. bat" file when you install it, and you'll see this service in the list of services.
Unloading
Create the Uninstall. bat file and open the file with Notepad with the contents
SC Delete TestService1
Save the file. Where TestService1 is the name of the service and is set at development time, not necessarily the same as the program name.
When uninstalling, simply double-click on the "Uninstall. Bat" file to run, at which point the service is no longer present in the list of services.
How to install and uninstall Windows services