码迷,mamicode.com
首页 > Windows程序 > 详细

Stop a hung service 关闭一个无响应的windows 服务

时间:2014-07-16 22:49:08      阅读:299      评论:0      收藏:0      [点我收藏+]

标签: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. 

Stop a hung service 关闭一个无响应的windows 服务,布布扣,bubuko.com

Stop a hung service 关闭一个无响应的windows 服务

标签:des   style   http   strong   width   art   

原文地址:http://www.cnblogs.com/moonlight-zjb/p/3835496.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!