A, cmd command line --- with the Windows operating services
1, installation services
sc create 服务名 binPath= "C:\Users\Administrator\Desktop\win32srvDemo\win32srvdemo\Debug\win32srvDemo.exe"
Note: Service name: Windows service name refers to the creation of
binPath: refers to the path to the Windows service program
2, configuration services
sc config service names start = AUTO
Note: start = AUTO (automatic)
start = DEMAND (manual)
start = DISABLED (disabled)
3, open service
net start service name
4, close the service
net stop service name
5. Delete Service
sc delete service name
Second, the first: bat batch --- with the Windows operating services
(Create a txt file, change the extension .bat file)
1, create, configure, start the service
. @echo service starts ...... @echo OFF @sc the Create service name = binPath "C: \ the Users \ Administrator \ Desktop \ win32srvdemo \ win32srvdemo \ Debug \ win32srvdemo.exe" @net Start service name @sc config service name = AUTO start @echo OFF @echo. Booted! @pause
2, shut down service
@echo. Services Close @echo OFF @net STOP service name @echo OFF @echo. Close the end! @pause
3, delete the service ( before deleting to turn off service )
@echo. Service to delete @echo OFF @sc the Delete service name @echo OFF @echo. deletion end! @pause
Second, the second: bat batch --- with the Windows operating services
1, the installation script Install.bat
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil.exe "E:\wwwroot\kjsmtt\wwwroot\KJLMManagerShareOutBonus\KJLMManagerShareOutBonus.exe" Net Start 服务名
sc config Service Name = Auto Start PAUSE
Note: The first line: Window service program execution path
Second row: Start Services
Third row: Set the service to run automatically
The last line: Pause, you can view operational information
2, uninstall script Uninstall.bat
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil.exe /u "E:\wwwroot\kjsmtt\wwwroot\KJLMManagerShareOutBonus\KJLMManagerShareOutBonus.exe" pause