Background:
A project into a Windows service, when debugging, you need to uninstall, install the service, but prompted the following error: "The specified service has been marked for deletion", enter the service management interface, start their own registered services, can not be manually changed to enable mode (when the startup type is displayed is disabled), the same prompt " The specified service has been marked for deletion.
Workaround:
I closed the Service Management window and the problem naturally solved (restart the machine when necessary). Therefore, the reason for this is that the Service Management window is not closed when the Delete Service item command is run.
Install (I put the C_jk.exe file in the Shyy folder):
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil.exe E:/shyy/c_jk.exepause
Unloading:
C:\windows\microsoft.net\framework\v2.0.50727\installutil/u C_jk.exepause
Both the install and uninstall are written in the bat file and are located in the same folder as the C_jk.exe file.