I know that one can use Windows taskkill utility to "kill" a non-responsive process. But what happens if I call it on a process that is running and has no issues -- will taskkill try to quit it normally first?

PS. The reason I'm asking is because I want to use taskkill from a script to close one program, but I won't use it if it "forcefully" terminates the program's process without first letting it quit "gracefully."

1 Answer 1


By default, the taskkill utility will send a WM_CLOSE signal to the process. This is the same signal as is sent when you click the red x in the titlebar.

A well written app will listen for this signal, and initiate clean-up and close.

If it is stuck, it won't be able to do this, and so is deemed unresponsive. Taskkill willl wait for normal shutdown and then prompt the user for an unconditional shutdown.

You can use the /f parameter to go straight to unconditional shutdown.

So in answer to your question, if you want to not-forcefully close an app, use taskkill without the /f parameter.

  • 1
    Thanks. How do you know that it "sends a WM_CLOSE signal to the process"?
    – MikeF
    Oct 30, 2014 at 3:09
  • 1
    @MikeF I don't "know" it, I accept what others have found to be probably true. You can do the same, or you could find an app that watches the message pump, do a taskkill and see if WM_CLOSE appears in the queue. To indirectly confirm, open notepad, write stuff in it, then taskkill notepad. You should get a confirmation to close or save from notepad, which means it recieved a close signal rather than being terminated. Then do the same with taskill /f to see the difference.
    – Paul
    Oct 30, 2014 at 3:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.