How to stop a Windows Service (SC) in the stopping status)

Source: Internet
Author: User

During the test, you need to start and stop Windows service. Sometimes the service is in the stopping or starting status. However, in the services interface, the Start Service/Stop Service is gray and cannot be operated. Net start/stop servicename in the form of command line does not help. The method to stop the service is to disable the process, but it is often unable to determine which process is related to it. In the command line, we can use the SC queryex servicename command to obtain information about the service.

For example,

Run'SC queryex olsladtservice'In Command Prompt

The output is below,

SERVICE_NAME: olsladtservice
Type: 10 win32_own_process
State: 4 stopping
(Stoppable, not_pausable, accepts_shutdown)
Win32_exit_code: 0 (0x0)
Service_exit_code: 0 (0x0)
Checkpoint: 0x0
Wait_hint: 0x0
PID: 4652
Flags:

Then we can use 'taskkill/PID 4652/F' in command prompt to kill the process./f means 'Kill forcely '.

The SC function is very powerful. For details, refer to the following two links:

Http://bartdesmet.net/blogs/bart/archive/2004/10/16/438.aspx

Http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ SC .mspx? MFR = true (more info on SC .exe)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.