How to close a program on Windows without CTRL + ALT + DEL

Often while writing and testing a software program, I’ll run into an issue where the program refuses to terminate. In this situation, it can be difficult to find the offending task within the Windows Task Manager and even if I do, the Task Manager sometimes can’t close the program.

Most will resort to restarting their computer in this situation but that solution can be dangerous, especially if there is unsaved work (which is often the case when a program overloads the computer so much that it can’t terminate). A safer and more reliable solution is to use command line. This might seem like a daunting approach for people that aren’t used to programming, but I hope this step-by-step can make it a less intimidating task.

1. Open the Windows Command Prompt

Type in “cmd” in the Windows search and click “Command Prompt.” This will open a black box. If you don’t already feel like a 90’s movie hacker, you will soon.

2. Type in “tasklist” on the prompt

This won’t solve the problem yet, but it will show you all the tasks that are currently running. Each task has a name, a process ID (PID), and other useful information that is also shown in the Windows Task Manager GUI.

From here, you can try to find the offending task and grab its PID, but that will be just as hard (if not harder) as finding the task in the Windows Task Manager.

3. Try to find the name of the program you’re trying to close

Excel is one of the common offenders that I have to close using this method. In the screenshot below, EXCEL.exe is the program I’m trying to find. What I really want is its process ID (PID), which will be used to close the program in a later step. Visually scanning this list is hard, but a one line command can help.

4. Search the tasklist programmatically

Type “tasklist | findstr /i excel” in the console. This command takes the tasklist and searches through the results for anything that contains the word “excel.” The pipe character “|” is generated using SHIFT + backslash on most keyboards.

There are several things to note here: commands are case sensitive — “tasklist” is not the same as “Tasklist” or “TASKLIST”. Also, make sure the commands are appropriately spaced and ordered. For instance, placing “/i” after “excel” will not work. Last, if you forgot to include “/i” the search will be case sensitive, meaning that “excel” will not find “EXCEL.”

If you want to find a different program, simply replace “excel” with a new search, e.g. “chrome” or “teams.”

5. Close the offending program

In the example above, EXCEL.EXE has a PID of 35092. That is what we will use to close the program.

In the console, type “taskkill /PID 35092” — make sure to replace the task ID of my example with whatever you found.

You will either get a success or failure message. Sometimes, a failure will occur and the message will give some hint about the issue. The first step to try to get around a failure is to force close the program by adding “/F” to the command.

One common issue is that the program that is being targeted for closure is being run with administrative privileges. If the command prompt is not being run as an administrator, it won’t be able to force a close. To solve this, simply re-open the command prompt as an administrator. Go to the Windows search, look for the command prompt, and instead of left-clicking command prompt directly, use a right-click. This will open a pop-up — select “Run as administrator.” This will open a log-in screen with administrator credentials — enter those and a new prompt will open up with administrator powers. Repeat the steps above to find and close the program.

Conclusion

You are now a hacker! Reply to this story if you have any further questions or issues.

Consultant, developer, statistical analyst. Published reports with CMS and the FDA along with a manuscript in the journal Vaccine.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store