I'm looking for a program that would allow me to switch two windows between two monitors by mouse clicks and/or keyboard with as few clicks and/or key strokes as possible.

For example, program A is on monitor 1 and program B is on monitor 2. If I want to switch the location of program A and program B, I just want to have to left-click on program A then left-click on program B, then hitting some keyboard shortcut to have them switch.

It should have the following features:

  • works Windows 7
  • supports at least 6 monitors
  • eats as little CPU as possible
  • free is preferred
  • as responsive as possible
  • as bug-free as possible

1 Answer 1


This kind of ad-hoc task tends to be best solved by a generic automation framework to provide basic building blocks (e.g. commands to retrieve window geometries and move windows around), with a small script that implements your specific requirement.

On Windows, AutoHotkey is a general-purpose desktop automation scripting environment for Windows. It's open source. The scripting language makes Basic look not so bad, but it gets the job done.

Here's a script which switches the position of two windows. It works the way you describe: click on one window, switch to another window, and these two windows will be transposed. The script binds the action to the keyboard shortcut Ctrl+Alt+F; change the ^!f:: line to pick the hotkey you prefer. After installing AutoHotkey, save this script to a file called flip-windows.ahk (the name isn't significant, only the extension is) and add it to your startup scripts (or run it once to test; there's an icon in the task bar with an exit command).

;; Switch the position and size of the active window with the one immediately after in
;; top-to-bottom z-order.
;; This action is bound to the hotkey Ctrl+Alt+F.

#SingleInstance force

;; Bind the action to Ctrl+Alt+F

;; Set id1 to the window ID of the active window
WinGet, id1, ID, A
;; Set id2 to the window ID of the next active window (the one that Alt+Tab would
;; switch to). To do this, iterate over the active windows in top-to-bottom order.
;; This order is: first permanently-raised windows, then the active window, then
;; the next active window.
WinGet, ids, List
Loop, %ids%
  current := ids%A_Index%
  IfNotEqual, current, %id1%, Continue
  next_index := A_Index + 1
  id2 := ids%next_index%

;; Retrieve the coordinates of the two windows
WinGetPos, x1, y1, w1, h1, ahk_id %id1%
WinGetPos, x2, y2, w2, h2, ahk_id %id2%

;WinGetTitle title1, ahk_id %id1%
;WinGetTitle title2, ahk_id %id2%
;MsgBox %id1% "%title1%" %w1%x%h1%+%x1%+%y1% <-> %id2% "%title2%" %w2%x%h2%+%x2%+%y2%

;; Move the two windows to each other's coordinates
WinMove, ahk_id %id1%, , %x2%, %y2%, %w2%, %h2%
WinMove, ahk_id %id2%, , %x1%, %y1%, %w1%, %h1%

If you just want to send a window to another monitor, Windows 7 has this built-in (Win+Shift+Left, Win+Shift+Right), but if that's not exactly what you want you may be able to build something better with AHK (some sample AHK scripts may inspire you, e.g. 1).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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