On Unix or Linux, it's easy to gracefully ask a running application to terminate: you send it the SIGTERM signal. If its process ID is 1234, you can simply run kill 1234 or kill -s TERM 1234 or kill -15 1234.

How can I do the same thing in Windows?

If I recall correctly, Task Manager's "End Task" feature (not its "End Process" feature) used to do what I want. But, as of Windows 8.1, it's no longer so gentle; when I use the feature, it causes me to lose unsaved data.

I don't want to write any code in order to do this. If I did, I would ask on Stack Overflow. :)


3 Answers 3



You can use taskkill.exe. (Source.) It's part of Windows.

To terminate the process with process ID 1234:

taskkill /pid 1234

To terminate Windows Notepad:

taskkill /im notepad.exe

To save keystrokes:

taskkill /im notep*

For more help:

taskkill /?

If you add /f this forces the app to close no matter what. If you don't add /f, taskkill will merely gracefully ask the app to close. (Source.)

Or just log out

If you don't want to bother with any of this, simply log out of your Windows user account, then log back in again.

Console applications

Regarding console applications (e.g. PowerShell), Chris Becke adds:

There is no real way to close console applications gracefully on Windows. They need to support some kind of graceful close mechanism.


You can use rmlogotest.exe: the Restart Manager Logo Test Tool. This freeware utility, written by Microsoft, is part of the Windows App Certification Kit.

To get the latest version of the Windows App Certification Kit, download and run the Windows SDK installer. (You can find the Windows SDK installer by doing a Web search.) Uncheck all the boxes except for the Windows App Certification Kit box. Wait for the kit to be downloaded and installed. If I recall correctly, the kit is a couple hundred megabytes.

If you're using the Windows 11 SDK, I guess rmlogotest.exe might be in C:\Program Files (x86)\Windows Kits\10\App Certification Kit.

Open a command prompt. Change to the correct directory. Enter rmlogotest then a space then the process's process ID number.

If the process is "Restart Manager aware", rmlogotest will gracefully restart it and tell you "Logo Validation Passed". Otherwise, rmlogotest will ask it to gracefully terminate, then may tell you "Logo Validation Failed".

I tried using rmlogotest.exe to terminate Notepad, and it worked as expected. Notepad asked me whether or not I wanted to save the unsaved text which I'd entered.

(In case you wonder what Restart Manager is and does, let me explain. Restart Manager is part of Windows, and is used by Windows Installer 4.0 and up. When Windows Installer needs to overwrite or delete an open file, it uses a three-step process. It tells Restart Manager to gracefully end the process which is using the file. It overwrites the file. Then it tells Restart Manager to start the process again.)


GnuWIN32 has windows ports of common linux utils including kill.exe


It supports the following signals by name, or a number

λ kill -l                                                                                                                                                                                                                                                                

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .