How To Close All Open Windows at Once

Want to close all open windows at once? It is pretty simple. Here’s how to close all open windows simultaneously with one keyboard shortcut.

It’s not always or for everyone, but there will be situations where you must close all the open windows at once. There are many advantages to bulk closing open windows. For instance, when you want to shut down the system quickly, you can close all windows at once with a shortcut rather than closing one window at a time. This trick is especially helpful if you have a lot of windows to close. On the other hand, you might also want to close all windows simultaneously for privacy reasons.

Apart from all that, one other significant advantage of closing all open Windows together is that it saves time and, in turn, boosts your productivity.

So, without further ado, let me show you how to close all windows at once.

The steps below work the same in Windows 10 and 11.

Close all windows shortcut

To close all windows with a keyboard shortcut, we will create an AutoHotKey script. The script is pretty simple and works like a charm.

If you are wondering, Windows has no built-in option to do the job perfectly. As such, we have to use AutoHotKey. It is a free and open-source Windows automation software.

Here is how to create and use the AutoHotKey script to close all windows with a shortcut.

  1. Get and install the AutoHotKey software.
  2. Right-click on the desktop.
  3. Select “New > Text Document.”
  4. Open the text file.
  5. Paste the AutoHotKey script.
  6. Close the text file.
  7. Rename the file to “CloseAllWindows.ahk.”
  8. Double-click the .ahk file.
  9. The AutoHotKey script is running in the background.
  10. Press “F3” to close all open Windows.

Steps with more details:

First, download and install AutoHotKey in Windows if it is not already installed.

Download AutoHotKey:

Now, we need to create the AutoHotKey script. To do that, right-click on the desktop and choose “New > Text Document.” This action creates a new blank text document.

create new text document

Double-click on the newly created text file. It should open in Notepad. Now, paste the below script into the text file. Press “Ctrl + S” to save the file.

Note: The default shortcut is F3. If you want to use another shortcut of your choice, I recommend you take a look at the AutoHotKey Hotkeys documentation —

; Close all Windows with a keyboard shortcut (F3)
WinGet, id, list, , , Program Manager
Loop, %id%
 StringTrimRight, this_id, id%a_index%, 0
 WinGetTitle, this_title, ahk_id %this_id%
close all Windows at once shortcut

After saving the file, close it. Next, rename the file to “CloseAllWindows.ahk.” If you are wondering, you can name the file whatever you want. However, ensure that you replaced the .txt extension with .ahk.

rename file with ahk extension

After renaming the file, double-click on it. This action starts the script, and it runs silently in the background.

As long as the script is running in the background, press “F3” to close all open windows. It will not close applications minimized to the taskbar corner/corner overflow menu.

Alternate method:

If you don’t want to use AutoHotKey, you can use a PowerShell command in a batch file to close all open windows. However, the drawback of the script is that it doesn’t close File Explorer windows and is pretty slow. Moreover, there are quite a few exceptions where the script doesn’t work as it should.

If you are OK with the drawbacks, follow the below steps.

Right-click on the desktop and choose “New > Text Document” to create a new text file.

Open the text file and paste the below script into it. Press “Ctrl + S” to save the file.

powershell "&{Get-Process | Where-Object {$_.MainWindowTitle -ne ''} | stop-process}; (New-Object -comObject Shell.Application).Windows() | where-object {$_.LocationName -eq 'Control Panel'} | foreach-object {$_.quit()};"

Now, rename the file to “CloseAllWindows.bat.”

Double-click on the file to execute it. All Windows except File Explorer should close immediately.

That is it. It is that simple to close all Windows at once with a shortcut.

I hope this simple and easy Windows how-to guide helped you.

If you are stuck or need some help, send an email, and I will try to help as much as possible.

Scroll to Top