This article was reproduced from: http://blog.csdn.net/moruna/article/details/9190733
Don't say much nonsense, look at the command line more directly!
First, the direct use of CMD to service some of the operation
1. Installation Services
SC create test3 binpath= "C:\Users\Administrator\Desktop\win32srvDemo\win32srvdemo\Debug\win32srvDemo.exe"
Where: Test3 is the name of the service created, and BinPath is followed by the path where the exe file is run
2. Configuration Service
There are the following centralization methods:
sc config service name Start=auto (automatic)
sc config service name start= DEMAND (manual)
sc config service name start= DISABLED (disabled)
For example, the following command will start automatically on the XP system:
sc config test3 start= AUTO
3. Open Service
net start Test3
4. Close the service
net stop Test3
5. Delete Service
SC Delete Test3
Second, for the convenience of use, can be edited as a bat batch file
(Create a new TXT file, name it yourself, and change the suffix to. bat file)
1. Create, configure, and open services
@echo. Service startup ... @echo off @sc create Test3 binpath= "C:\Users\Administrator\Desktop\win32srvdemo\win32srvdemo\Debug\ Win32srvdemo.exe " @net start test3 @sc config test3 start= AUTO @echo off @echo. @pause
2. Close the service
@echo. Service off @echo off @net stop test3 @echo off @echo. Close the end! @pause
3. Delete Service
@echo. Service removal @echo off @sc Delete test3 @echo off @echo. Delete End! @pause
Third, about SC
can refer to a Netizen's blog---SC Command Management Service Status: http://blog.csdn.net/ddjj_1980/article/details/7493045
Go SC Command---Install, open, configure, and close the Windows Service Bat batch