Collapses the specified window into a button on the task bar.

WinMinimize , WinTitle, WinText, ExcludeTitle, ExcludeText



A window title or other criteria identifying the target window. See WinTitle.


If present, this parameter must be a substring from a single text element of the target window (as revealed by the included Window Spy utility). Hidden text elements are detected if DetectHiddenText is ON.


Windows whose titles include this value will not be considered.


Windows whose text include this value will not be considered.


Use WinRestore or WinMaximize to unminimize a window.

WinMinimize minimizes the window using a direct method, bypassing the window message which is usually sent when the minimize button, window menu or taskbar is used to minimize the window. This prevents the window from overriding the action (such as to "minimize" to the taskbar by hiding the window), but may also prevent the window from responding correctly, such as to save the current focus for when the window is restored. It also prevents the "minimize" system sound from being played.

If a particular type of window does not respond correctly to WinMinimize, try using the following instead:

PostMessage, 0x0112, 0xF020,,, WinTitle, WinText ; 0x0112 = WM_SYSCOMMAND, 0xF020 = SC_MINIMIZE

This command operates only upon the topmost matching window except when WinTitle is ahk_group GroupName, in which case all windows in the group are affected.

Window titles and text are case sensitive. Hidden windows are not detected unless DetectHiddenWindows has been turned on.

WinRestore, WinMaximize, WinMinimizeAll


Opens Notepad, waits until it exists and minimizes it.

Run, notepad.exe
WinWait, Untitled - Notepad
WinMinimize ; Use the window found by WinWait.

Press a hotkey to minimize the active window.

^Down::WinMinimize, A  ; Ctrl+Down