SC command --- install, enable, configure, and disable the cmd command line and bat batchcompute windows Service, scbat
1. cmd command line-perform Windows service operations
1. Install the service
SC create service name binPath = "C: \ Users \ Administrator \ Desktop \ win32srvDemo \ win32srvdemo \ Debug \ win32srvDemo.exe"
Note: Service name: the name of the created Windows service.
BinPath: the path of the Windows service program.
2. Configure the service
SC config service name start = AUTO
Note: start = AUTO (automatic)
Start = DEMAND (manual)
Start = DISABLED (DISABLED)
3. enable the Service
Net start service name
4. Close the service
Net stop service name
5. delete a service
SC delete service name
Ii. bat batch processing-perform Windows service operations
(Create a txt file and change the suffix to the. bat file)
1. Create, configure, and enable services
@ Echo. service Startup ...... @ echo off @ SC create service name binPath = "C: \ Users \ Administrator \ Desktop \ win32srvdemo \ win32srvdemo \ Debug \ win32srvdemo.exe "@ net start service name @ SC config service name start = AUTO @ echo off @ echo. started! @ Pause
2. Close the service
@ Echo. Close the service @ echo off @ net stop service name @ echo off @ echo. Close the end! @ Pause
3. delete a service (close the service before deletion)
@ Echo. Service deletion @ echo off @ SC delete service name @ echo off @ echo. The deletion is complete! @ Pause
Ii. SC commands
Blog: http://blog.csdn.net/ddjj_1980/article/details/7493045
Reprinted: http://blog.csdn.net/moruna/article/details/9190733