Rune Bune’s Blog

Games, Gadgets, Code & Tech

How to Kill a Windows NT Service in command prompt

Posted by runebune on April 24, 2009

Go to the command-prompt and query the service (e.g. the SMTP service) by using sc:

sc queryex SMTPSvc
This will give you the following information:

SERVICE_NAME: SMTPSvc
TYPE : 20 WIN32_SHARE_PROCESS
STATE : 4 RUNNING
(STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0×0)
SERVICE_EXIT_CODE : 0 (0×0)
CHECKPOINT : 0×0
WAIT_HINT : 0×0
PID : 388
FLAGS :

or something like this (the “state” will mention stopping).
Over here you can find the process identifier (PID), so it’s pretty easy to kill the associated process either by using the task manager or by using taskkill:

taskkill /PID 388 /F

where the /F flag is needed to force the process kill (first try without the flag).

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>