I have looked at various solutions to this but none worked.

How can I prevent Alt+Tab in Windows 10 from switching to minimized windows?


The solution is to use Alt+Esc

It'll switch to the next open window, skipping minimized ones. More importantly it works even if the Windows Shell hangs up and Alt+Tab stops working

Unfortunately, with all this excitement attached to Alt+Tab, another hotkey has been woefully neglected. Windows 2.0 introduced the Alt+Esc hotkey. Whereas Alt+Tab lets you pick an application, Alt+Esc lets you cycle through them.

When you press Alt+Esc, the active window is sent to the bottom of the window stack, allowing the window beneath it in the z-order to become the new active window. And if the next window is a minimized window, it stays minimized. While this may sound like an annoyance, it is actually a useful device, as it lets you skip past minimized applications without having to open them.

Raymond Chen Discusses the Alt+Tab and Alt+Esc Hotkeys

  • 1
    the issue is I can't toggle between two windows with Alt+Esc – kofifus Oct 22 '17 at 4:39
  • Yeah, I'd forgotten about Alt-Esc, I tend to use Alt-Tab and Alt-Shift-Tab to move back/forth, age-old habit. This sequence works for me between two windows (unfortunately regardless of minimize status). – PeteG Oct 22 '17 at 5:46
  • 1
    @kofifus you can use Alt+Esc and Alt+Shift+Esc to toggle back and forth. Otherwise you'll need an autohotkey script – phuclv Oct 22 '17 at 5:59

The following script for AutoHotkey v1.1 fixes this issue by detecting when any window is minimized, and forcing it toward the end of the alt-tab list by temporarily changing window styles. The script runs in the background and does not require using a specific hotkey (or any hotkey).

; Use a shell hook to detect minimize and fix the alt-tab order.
OnMessage(DllCall("RegisterWindowMessage", "str", "SHELLHOOK"), "ShellHook")
DllCall("RegisterShellHookWindow", "ptr", A_ScriptHwnd)

ShellHook(wParam, lParam)
    if (wParam != 0x5) ; HSHELL_GETMINRECT
    hwnd := NumGet(lParam+0)
    WinGet minmax, MinMax, ahk_id %hwnd%
    if (minmax = -1) ; Minimized
        ; Remove the window from the alt-tab list temporarily to force
        ; it to the end of the list.  To do this, temporarily apply the
        ; WS_EX_TOOLWINDOW style and remove WS_EX_APPWINDOW (if present).
        WinGet oldxs, ExStyle, ahk_id %hwnd%
        newxs := (oldxs & ~0x40000) | 0x80
        if (newxs != oldxs)
            WinSet ExStyle, % newxs, ahk_id %hwnd%
            WinSet ExStyle, % oldxs, ahk_id %hwnd%

Caveat: This may have adverse effects on some windows since it modifies the window's extended style attribute (temporarily). I did not observe any issues during my testing.

I found that temporarily removing the window from alt-tab moved it almost to the end of the list. If I minimize multiple windows in a row, the first one appears last, with each subsequent minimized window inserted before the others (but after all other windows).

I tested on Windows 10 v1709. Results may vary on other systems.

  • Great ! Can I hook this to replace the existing Alt+Tab ? how ? – kofifus Dec 11 '17 at 0:41
  • It does not "replace Alt+Tab". It manipulates windows, as I explained. You just run the script using AutoHotkey v1.1. Basically, install AutoHotkey, save the script text as a file with .ahk extension, open the file. If it works, add it to system startup via whatever method. – Lexikos Dec 18 '17 at 1:17

I agree with what @LưuVĩnhPhúc suggested, and I went ahead and wrote a short AutoHotkey script that does more or less that.

The Script

forward := true
cycling := false

~Alt Up::
if cycling
    forward := !forward
cycling := false


    global cycling
    if direction
        send !{Escape}
        send !+{Escape}
    cycling := true


Install the program, put this in an .ahk file somewhere and run it. It will set Alt+Tab to use Alt+Escape and Alt+Shift+Escape alternatingly so you can switch back and forth. The last line makes it so that Alt+Escape functions as the regular Alt+Tab, in case you want to still have access to that functionality. You can remove it if you want.


  1. This script changes Alt+Tab to be either Alt+Escape or Alt+Shift+Escape, changing its direction whenever you release the Alt key after having switched windows (i.e. also pressed Tab) at least once.

    This doesn't change the mechanism behind Alt+Escape, so if you hold Alt and press Tab twice, you may not get to the second-before-last window you were in. Also when the direction is "reversed" you may get "older" windows (windows you haven't used in a while) before you get recent ones, with the exception of the last window you switched to; you'll get that one (that's the whole reason I made that flip in direction in the first place).

  2. Ctrl+Alt+Tab still retains its original function - i.e. it uses the regular Alt+Tab mechanism. No idea what you want to do about that.

More Complicated Alternative

Another option is to write a program that can hide all the currently minimized windows and restore them, then use AutoHotkey to make Alt+Tab activate that program to hide all the minimized windows before letting the Alt+Tab through, and then have it show them again when you release Alt after having switched windows (no need to do it if you press Alt for other reasons).

This requires more work, however, and it'll result in your open applications in the taskbar changing while you switch windows and reverting when you stop, which may look strange.

If you choose to do this, I suggest you take notice not to invoke the program simply on Alt+Tab, but only on the first time you press that combination since you've held down Alt.

  • thx ! but switching back and forth between windows using two consequtive alt+tab is essential for me. Is it possible to write a script that covers that as well ? – kofifus Oct 24 '17 at 22:50
  • I think you misunderstood me. I wrote this script to do just that. Try it out, see for yourself. – Tomer Godinger Oct 25 '17 at 4:22

I use a second "Virtual Desktop" for this type of stuff, it works really well.
You can move the apps/windows to the secondary/tertiary/... desktop, and that desktop will only have that subset of tabs (I use Alt+Tab constantly, so I'm fairly keyed into your "problem").

Drag-drop works for moving the apps quickly, and there are other shortcuts and managers, if you want to have more semi-permanent virtual desktops for a certain task(s).

  • thx but this is not what I'm looking for – kofifus Oct 22 '17 at 1:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.