Sometimes it is necessary to start and stop Windows Service at work, sometimes the service is in stopping or starting state, but in the Services interface, start Service/stop The service is already in a gray, non-operational state, and using the command line form of net start/stop servicename is useless. The method of stopping the service is to turn off the process, but many times it is not possible to determine which process is associated with it. At the command line we can use the SC queryex servicename command to get information about the service.
For example,
Run ' sc queryex websensedcagent ' in command prompt
The output is below,
Service_name:websensedcagent
Type:10 win32_own_process
State:3 stop_pending
(Stoppable, not_pausable, Accepts_shutdown)
win32_exit_code:0 (0x0)
service_exit_code:0 (0x0)
checkpoint:0x0
Wait_hint:0x1d4c8
pid:4488
FLAGS:
After viewing the process number of this service we can force the process of ending this service with the command ' Taskkill/pid 4488/f '. /F means ' kill forcely '.
Original: http://allanfan.blog.51cto.com/520839/1193132/
How to force shutdown services