Guide

How to Close All Programs on Windows at Once

Windows gives you several ways to close programs, but no single “close everything” switch. Here’s every practical method — built-in shortcuts, Task Manager, the command line, a PowerShell script, and a one-click tray button — with the real cost of each.

Minimising is not closing

Worth getting out of the way first, because it is behind a lot of “my PC is still slow” frustration. Minimising a window, or hiding it with Win+D, changes nothing about what is running. The program keeps its memory, keeps its CPU time, keeps its network connections, and keeps firing notifications. Everything below actually closes programs.

Method 1: Alt+F4, window by window

Alt+F4 closes the active window. Combine it with Alt+Tab to walk through everything open: switch, close, switch, close. Programs with unsaved work show a save prompt each time.

It works, it’s built in, and for two or three windows it’s fine. For fifteen windows across five programs it’s a minute of keystrokes, and one stray Alt+F4 on an empty desktop opens the shutdown dialog instead — which is the single most common way this method goes wrong.

Note that Alt+F4 closes a window, not a program. A browser with four windows needs four presses, and some programs keep running in the tray after their last window closes.

Method 2: Task Manager

Ctrl+Shift+Esc opens Task Manager. Select a program, press End task, repeat. Two things to know:

  • You close one program at a time — there is no select-all.
  • End task is a hard kill: no save prompt, no clean shutdown. Apps may show crash-recovery dialogs the next time they start.

Stay on the Processes tab and end things listed under Apps. The Background processes and Windows processes groups below are where the things holding your session together live.

Method 3: taskkill from the command line

To close a specific program gracefully (it gets a close message, like clicking the X):

taskkill /IM notepad.exe

To force it:

taskkill /IM notepad.exe /F

Closing everythingwith taskkill means listing every process name yourself — and getting the list wrong can take down things you need. Windows has no safe built-in “all user apps, but not the system” filter; that filtering is exactly the hard part.

Method 4: A PowerShell script

This is the approach most “panic button” tutorials land on, and it is worth doing properly. The trick is to select on having a window rather than on a list of names — a process with a main window title is an application, and a process without one is usually infrastructure:

Get-Process | Where-Object {$_.MainWindowTitle -ne "" -and $_.ProcessName -ne "explorer"} | ForEach-Object {$_.CloseMainWindow()}

CloseMainWindow() sends the same close message the X button does, so programs shut down cleanly and unsaved-work prompts still appear. Many versions of this script you will find online end with Stop-Process -Force instead — that is a hard kill with the Task Manager problem: nothing saves, and you collect crash-recovery dialogs. Prefer the polite version.

Save it as a .ps1 file, and you can pin a shortcut to it or bind it to a key. What you own from then on: the exclusion list. explorer is the obvious one, but as you install more software you will find other things that need adding, and you find them by having something break.

Method 5: One click from the system tray

Captain Kill Switch puts that sweep in the system tray, with the two hard parts already solved. One click: every open program gets a normal window close message first — the same signal as clicking the X, so well-behaved apps exit cleanly — and anything still running about two seconds later is closed firmly, so a single stuck save dialog cannot stall the whole thing.

The Windows shell, Explorer and system processes are protected by an allowlist that is maintained for you, which is the part the PowerShell script leaves as your problem. Only programs with visible windows are ever targets. Free, tiny, auto-updating.

The honest trade-off:the two-second window isn’t enough to act on save dialogs — unsaved work closes. Save first. What you get in exchange: a clean desktop in seconds and no crash-recovery prompts on relaunch, unlike Task Manager’s End task.

One thing to expect on install: Windows may show a SmartScreen warning — click More info, then Run anyway. SmartScreen flags applications it hasn’t seen downloaded widely yet, so a new app trips it regardless of what it does; the warning clears by itself as the install count grows. Worth knowing before you meet it rather than after.

What not to do

  • Ending explorer.exe. Your taskbar, Start menu and desktop icons all disappear. It is recoverable — Task Manager → Run new task → explorer.exe — but it is never what you wanted.
  • taskkill /F with a wildcard. Force-killing broadly is how people end up with a corrupted profile or a half-written file.
  • Signing out to close everything. It works, but it also tears down your session, and coming back is far slower than reopening two apps.
  • “RAM cleaner” and booster utilities. Windows manages memory well; the real lever is having fewer programs open, which is the point of this page.

Troubleshooting

A program will not close. It is usually showing a modal dialog behind another window — Alt+Tab to it and look before force-killing anything.

It closed but is still in the tray. Some programs (chat apps, launchers) treat the X as minimise-to-tray. Right-click the tray icon and choose Exit, or close them from Task Manager.

Everything reopened after a restart.That is the “Automatically save my restartable apps and restart them when I sign back in” setting in Sign-in options, not a failed close.

Quick comparison

  • Alt+F4 loop: free, keeps save prompts, slow at scale, closes windows not programs.
  • Task Manager: free, hard kill, risks crash-recovery state, one at a time.
  • taskkill: scriptable, but you own the safety filtering.
  • PowerShell script: closest DIY equivalent; polite if you use CloseMainWindow, and you maintain the exclusions.
  • One-click tray button: instant, allowlist maintained for you; closes unsaved work by design.