Stop a hung service 關閉一個無響應的windows 服務

來源:互聯網
上載者:User

標籤:des   style   http   strong   width   art   

If you ever have trouble with a service being stuck in a ‘starting‘ or ‘stopping‘ state, you can run a couple of simple commands to kill the service.

1. Query the process

To kill the service you have to know its PID or Process ID. To find this just type the following in at a command prompt:

sc queryex servicename 
<Enter>

Replace ‘servicename‘ with the services registry name. For example: Print Spooler is spooler.

 


C:\Users\yemen_000>sc queryex MSSQL$SQLEXPRESS

SERVICE_NAME: MSSQL$SQLEXPRESS
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
PID : 2184
FLAGS :

 
 
2. Identify the PID

After running the query you will by presented with a list of details. You will want to locate the PID. 

 
 
3. Run the Taskkill command

Now that you have the PID, you can run the following command to kill the hung process:

taskkill /f /pid [PID] 
<Enter>

This will force kill the hung service. 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.