Windows – keyboard shortcut to close windows from the Windows 7 taskbar window selector

keyboard shortcutswindows 7

If, for example, Windows Explorer is in the first position of the taskbar and there are multiple explorer windows open, holding the Windows Key and pressing 1 will cycle through the available windows and display an x on the top-right of the selected item that can be clicked to close the window.

Is there a keyboard shortcut to close the selected window while still keeping the window list around (moving to the next item)?

The Windows 7 Taskbar Windows Selector

Best Answer

As other have mentioned, there is no built-in keyboard shortcut. However, we can work some magic with AutoHotkey. I am going to use the Backspace key to close the highlighted Taskbar window:

LastNumber := ""

~*1::LastNumber := "1"
~*2::LastNumber := "2"
~*3::LastNumber := "3"
~*4::LastNumber := "4"
~*5::LastNumber := "5"
~*6::LastNumber := "6"
~*7::LastNumber := "7"
~*8::LastNumber := "8"
~*9::LastNumber := "9"
~*0::LastNumber := "0"

*BackSpace::
    IfWinActive, ahk_class TaskListThumbnailWnd
    {
        WinKey := "LWin"
        if (GetKeyState("RWin"))
            WinKey := "RWin"
        
        SendInput, {Enter}
        WinClose, A
        
        SendInput, {%WinKey% Down}{%LastNumber% Down}{%LastNumber% Up}
    }
    else
        SendInput, {BackSpace}
    return

Instructions:

  1. Press and hold the Windows key down. Do not release it until instructed!

  2. Press a number key until the target window is highlighted.

  3. Press the Backspace key. The highlighted window will be closed! If the there is only one window left, then that window will be activated, otherwise the window group list will return.

  4. Repeat steps 2 to 3 to close more windows.

  5. Finally, release the Windows key to be done.

This should work with Taskbar thumbnails enabled or disabled (as shown in the question).

Related Question