Is there a shortcut in Windows 7 to switch between windows in a given application only? I very much like this feature in OS X; what is its equivalent in Windows?
-
1Related (but for Linux): Linux Mint – switch between windows of the same application.– Scott - Слава УкраїніSep 23, 2017 at 4:16
-
<rant>I wish Redmond would focus on UX and add more Windows key shortcuts, like for this question. They give us 99% of stuff we don't want but don't just make our lives easier by making Windows easier to use. I guess it would take a junior programmer all of two hours to add a new shortcut for this.</rant>– Pete AlvinMay 15, 2018 at 14:04
15 Answers
If it is one of the first ten applications on the taskbar,
then (Win)+n,
where n is its position number,
will select it and cycle through the windows
(if there are more than one).
(Use 0 (zero) for the tenth application.)
For example, I have Windows Explorer and Internet Explorer pinned
as the first two things on my taskbar,
so I can use
+1
to cycle through my directories
and I can use
+2
to cycle through my browsers.
Some odd notes:
If you press and hold
and type (and release) a digit n, Windows will open the nth application on the taskbar. Repeatedly tapping n will cycle through the windows of that program, as discussed above. As stated by TranslucentCloud, if you then type Shift+n, it will cycle through them in reverse order, as with Alt+Tab and Ctrl+Tab, etc.
If the nth application on the taskbar is pinned but not running, then
+n will start it.
As ZYinMD points out, if there are multiple instances (windows) for task n, then
+n will display the thumbnails for the tasks until you release the
key. This can be useful if you have multiple instances (e.g., of Notepad or Word), since you may want to see which window is the one you want. But this behavior might not always be desired. ZYinMD points out that adding Ctrl (i.e., using
+Ctrl+n) will go directly (“instantly”) to the task without showing the thumbnails.
But, if you press and hold
and Shift, right from the beginning, and then type n, Windows will start a new instance (or at least a new window) of that application, even if it’s already running. (This will fail for some applications, like Windows Media Player, that don’t allow multiple windows to run simultaneously.)
And
+Ctrl+Shift+n will start a new instance of application n as administrator.
+n seems not to work with the numeric keypad.
-
1This doesn't seem to work on a multi screen setup where you extend the taskbar– ErfanFeb 20, 2015 at 3:35
-
1
-
1Windows 10 users, see my answer below (Ctrl+Win+Number). Not sure if it works on Win 7/8.– TaylanDec 29, 2019 at 13:43
-
2If you hold
control
at the same time (ctrl+win+n), you can switch between windows instantly without showing the thumbnail– ZYinMDJul 28, 2020 at 16:11 -
In Windows 7 and 8, although there is no shortcut I know of available from the keyboard alone, you can hold Ctrl while clicking the taskbar icon of the app you're interested in. Each time you do this a different window belonging to that app will come to the forefront.
In addition, the program VistaSwitcher sets up Win+F11 and Alt+` to switch between the current app's windows. (BTW, its web site says Windows 8 is not supported, but I've had luck with it under 8.1; the only problem I've seen so far is that it sometimes lists things like the search sidebar as open windows. I just ignore that, but YMMV.)
-
2HUGE quality of life improvement. While a dedicated hotkey would be more ideal, the WIN+# solution is severely limited by number of keys, poor ergonomics, and a dreadful delay, not to mention creating conflict between accessible hotkeys (1-4) and desired start bar location. Sep 8, 2015 at 11:43
-
1
-
You can also add items to the exclude list like the "New notification" and "Cortana" on Windows 10. May 29, 2016 at 23:02
-
1
-
1looks like the successor to vistaswitcher, which is named
alt-tab terminator
doesn't have the feature to tab between same application anymore– starcornMay 7, 2019 at 8:00
You can use AutoHotkey: www.autohotkey.com
And put this script there:
!`:: ; Next window
WinGetClass, ActiveClass, A
WinGet, WinClassCount, Count, ahk_class %ActiveClass%
IF WinClassCount = 1
Return
Else
WinGet, List, List, % "ahk_class " ActiveClass
Loop, % List
{
index := List - A_Index + 1
WinGet, State, MinMax, % "ahk_id " List%index%
if (State <> -1)
{
WinID := List%index%
break
}
}
WinActivate, % "ahk_id " WinID
return
!^`:: ; Last window
WinGetClass, ActiveClass, A
WinGet, WinClassCount, Count, ahk_class %ActiveClass%
IF WinClassCount = 1
Return
Else
WinGet, List, List, % "ahk_class " ActiveClass
Loop, % List
{
index := List - A_Index + 1
WinGet, State, MinMax, % "ahk_id " List%index%
if (State <> -1)
{
WinID := List%index%
break
}
}
WinActivate, % "ahk_id " WinID
return
Works very well for me. Using Autohotkey I also made my copy/paste/undo,... keys like Mac. Works great!
Eras
-
2This works great with some caveats: 1) For Chrome, it will cycle all Chrome-like windows including applications like Slack! 2) For modern apps -- and if you only have one modern-app window open -- it will open a random other modern app (i.e. if you have Calendar open and that's the only modern app open, it will open "Settings", or "Sports", or "Mail", etc.) Mar 7, 2016 at 22:02
-
@KirkWoll That's right. There is definitely room to improve it. I have not had the time to really dig into Autohotkey to make it happen...– SepermanMar 9, 2016 at 18:53
-
Great job, used it right away, thanks. A few points:
WinGet, List
returns the number of windows in theList
variable (as opposed to theList%n%
pseudoarray in which the handles are stored), so you can skip theWinGet, WinClassCount
call and check forList
instead. Also, the code seems to be identical for both hotkeys.– LebenitaSep 1, 2016 at 7:01 -
it's doens't work with me on Windows 10 64bit and Microsoft Office 2016. can you help ?– LukeOct 24, 2016 at 8:23
-
1This works well, however, it seems to switch between ALL windows regardless of desktop. I am using task view extensively and need to jump through windows on the same desktop only.– petrNov 23, 2016 at 18:36
Thanks, Erasmose, but your version of the autohotkey script will minimize a window if there are no other windows of that type. Sometimes you don't know, and minimizing is an annoying way to find out, so I modified your script like so:
!`:: ; Next window
WinGetClass, ActiveClass, A
WinGet, WinClassCount, Count, ahk_class %ActiveClass%
IF WinClassCount = 1
Return
Else
WinSet, Bottom,, A
WinActivate, ahk_class %ActiveClass%
return
!+`:: ; Last window
WinGetClass, ActiveClass, A
WinActivateBottom, ahk_class %ActiveClass%
return
oh, and I also changed last class to use shift instead of ctrl since I that's the modifier to go backwards with several other keyboard shortcuts. I love autohotkey.
-
1Cool. I updated my code based on yours and also a feedback I got on Autohotkey's forum. The new code won't loop through minimized windows just like how it is in Mac.– SepermanOct 17, 2014 at 4:09
-
@Seperman what if I want to loop through minimized windows as well. What do I have to change in your script to do that.– Ghos3tMar 9, 2018 at 9:42
-
This works well, except that it won't behave correctly with Chrome or Chrome/Electron-based apps (like VS Code and Slack), as it cycles through all of them. Jul 29, 2019 at 15:04
-
Instead of using window class name, I used process name to play nice with Electron based apps and Firefox/Thunderbird. Script at gist.github.com/snmishra/794c5f41693510c46ba9bedc839696a8 Sep 13, 2019 at 15:10
-
Easy Windows Switcher from Neosmart does exactly what you are after.
Here is the description from the Easy Windows Switcher Website
Easy Window Switcher makes switching between different windows as easy as alt+` (that's alt+backtick) like on a Mac. Forget having to
alt+tab
between a million-and-one different open windows to find the one you are looking for, with Easy Window Switcher, tabbing between windows of the same program is only a alt+` away.
-
1doesnt "always" work. If I'm working on a different application for some time, then come back, it stops working. Aug 25, 2017 at 7:55
-
Some applications that implement MDI provide Ctrl+Tab to switch between "Documents" under the same application instance. e.g. MS Office. But this is not a windows feature and is application dependent. For other software there are different short-cuts. e.g. Firefox does not provide this feature but there is an add-on that adds the functionality.
Additionally, here's a list of keyboard shortcuts provided in windows.
Also, there are existing discussions about Keyboard short-cuts in Windows.
Hope that helps.
-
2Also, some programs use (Ctrl)+(F6) for this. (Add (Shift) to reverse direction.) Jan 15, 2014 at 22:16
I created an AutoHotkey script to switch between same application's windows that work with regular Window Apps, Chrome Shortcuts and Chrome Apps.
Extra
In that Github repo there is another AutoHotkey script that could work well in tandem with this one, because you will be able to Open, Restore or Minimize your Apps using the hotkeys you want.
Example:
F7:: OpenOrShowAppBasedOnExeName("C:\Windows\System32\SnippingTool.exe")
F8:: OpenOrShowAppBasedOnWindowTitle("Gmail", "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --app=https://mail.google.com/mail/")
-
3This is the only answer that works on Chrome correctly, as it doesn't treat Chrome and Electron-based app as same. It works perfectly on Chrome, VS Code, Slack, etc. (On rare cases, it didn't cycle correctly on certain apps like Mintty/Cygwin, gVim, and sometimes on Powershell, if the title of windows got changed) Jul 29, 2019 at 15:24
-
3This needs to be the top answer. The other answers do not work with Chrome or VS Code, this one does. Thanks Juanma! Stopped me from needing to switch back to Linux. Jan 8, 2020 at 23:59
VistaSwitcher allows or for this feature. Its compatible with Windows 10, (although the name suggests otherwise). On Windows 8 and up, I suggest adding certain metro apps to the exclude list.
The top answer is good, but doesn't work on multi-monitor setups where the taskbar is set to only show icons on active monitor.
-
Win + n does work on my W7 system with multiple screens and the taskbar showing on main monitor only – is this what you meant or is there really a way to make the taskbar switch to the currently active monitor (which I imagine would be distracting)?– LebenitaSep 1, 2016 at 5:24
With AutoHotkey too, a more natural behavior:
; Switch between windows of the same application with Alt+(key above Tab)
; Icon: made by Freepik (www.freepik.com), licence CC 3.0 BY
; from https://www.flaticon.com/free-icon/switch-window_71630
; Script Licence: CC0 (Public Domain)
; Source: https://framagit.org/dr4Ke/AutoHotkey_scripts
KeyName := GetKeyName("sc029")
Menu, Tray, Tip, Switch between windows of the same applications with 'Alt+%KeyName%'
*!SC029::
WinGetClass, ActiveClass, A
WinGet, WinClassCount, Count, ahk_class %ActiveClass%
If WinClassCount = 1
Return
WinGet, List, List, % "ahk_class " ActiveClass
index := 0
if not GetKeyState("Shift") {
index := 1
}
;MsgBox, Entering Loop
While GetKeyState("Alt") {
If GetKeyState("Shift") {
index := Mod(List + index - 2, List) + 1
} else {
index := Mod(List + index, List) + 1
}
WinGet, State, MinMax, % "ahk_id " List%index%
if (State == -1)
{
continue
}
WinID := List%index%
WinActivate, % "ahk_id " WinID
ErrorLevel := 1
sleep 50
While (ErrorLevel != 0) and GetKeyState("Alt") {
KeyWait, sc029, DT1
}
}
return
-
This is indeed a more natural behavior. The other scripts use
WinSet, Bottom,, A
that sends the active window to the bottom-most of all other windows, and so, it hides the active window behind some other app window (if it exists). It just needs the fix to properly cycle between Electron/Chrome apps.– lepschAug 19, 2021 at 10:59
In addition to what Scott (https://superuser.com/users/150988/scott) shared:
ctrl+repeatedly click over the app icon in the task-bar also will do the job.
-
1
Using Autohotkey, here's my version, which works with Chrome and Electron apps. It was modified from @user332861's answer, so that it correctly distinguishes between Chrome and Electron apps such as Slack and Visual Studio Code. (To do that, it uses ahk_exe
instead of ahk_class
)
!`:: ; Next window if using alt-backtick
WinGet, ExeName, ProcessName , A
WinGet, ExeCount, Count, ahk_exe %ExeName%
If ExeCount = 1
Return
Else
WinSet, Bottom,, A
WinActivate, ahk_exe %ExeName%
return
!+`:: ; prev window, Alt+shift+backtick
WinGet, ExeName, ProcessName , A
WinActivateBottom, ahk_exe %ExeName%
return
For those of you who use AutoHotkey: if you followed other answers and made it work for alt `, but realized it won't work in Explorer windows, you could add these lines below ::
, before other code:
If WinActive("ahk_exe Explorer.EXE") {
Send ^#{1} ; change the number 1 to whichever position your explorer is pinned on Taskbar
Return
}
This will fall back to use the method in the accepted answer for Explorer only.
-
Out of curiosity: are you a doctor, or do you hail from the land of the Mason-Dixon Line? May 4, 2022 at 5:57
I created an AutoHotkey script that integrates nicely with Windows Task Switcher (Alt+Tab), providing all of its benefits: previews of app windows, click to select, arrow key navigation, only activate the single window that you want. Invoke/navigate with Alt+` and Alt+Shift+` (backtick) to cycle between windows having the same process name as the current window. I find this more usable than Win+num as it works for any app (rather than having to remember the pinned slot number), window previews are larger, the background doesn't get blurred and it mixes seamlessly with Alt+Tab navigation. Tested on Windows 10.
The main trick is to temporarily hide non-target application windows from Task Switcher by setting WS_EX_TOOLWINDOW
and unsetting WS_EX_APPWINDOW
. In order to set these windows styles on windows running as administrator, AutoHotkey needs to be signed or run as admin. I followed the very easy signing instructions here.
Some related threads that contributed:
- https://stackoverflow.com/questions/35971452/what-is-the-right-way-to-send-alt-tab-in-ahk
- https://autohotkey.com/board/topic/21657-alttab-window-list-get-a-list-of-alt-tab-windows/
!`::
{
WS_EX_TOOLWINDOW = 0x80
WS_EX_APPWINDOW = 0x40000
tw := []
aw := []
WinGet, processName, ProcessName, A
DetectHiddenWindows, Off
AltTab_window_list(1)
Loop, %AltTab_ID_List_0%
{
wid := AltTab_ID_List_%A_Index%
WinGet, processName2, ProcessName, ahk_id %wid%
if (processName2 != processName)
{
WinGet, exStyle2, ExStyle, ahk_id %wid%
if (!(exStyle2 & WS_EX_TOOLWINDOW))
{
tw.InsertAt(0, wid)
WinSet, ExStyle, ^0x80, ahk_id %wid%
}
if ((exStyle2 & WS_EX_APPWINDOW))
{
aw.InsertAt(0, wid)
WinSet, ExStyle, ^0x40000, ahk_id %wid%
}
}
}
Send {Alt Down}{Tab} ; Bring up switcher immediately
KeyWait, ``, T.25 ; Go to next window; wait .25s before looping
if (Errorlevel == 0)
{
While ( GetKeyState( "Alt","P" ) )
{
KeyWait, ``, D T.25
if (Errorlevel == 0)
{
if (GetKeyState( "Shift","P" ))
{
Send {Alt Down}{Shift Down}{Tab}
Sleep, 200
}
else
{
Send {Alt Down}{Tab}
Sleep, 200
}
}
}
}
Send {Alt Up} ; Close switcher on hotkey release
for index, wid in tw
{
WinSet, ExStyle, ^0x80, ahk_id %wid%
}
for index, wid in aw
{
WinSet, ExStyle, ^0x40000, ahk_id %wid%
}
}
return
AltTab_window_list(excludeToolWindows)
{
global
WS_EX_CONTROLPARENT =0x10000
WS_EX_APPWINDOW =0x40000
WS_EX_TOOLWINDOW =0x80
WS_DISABLED =0x8000000
WS_POPUP =0x80000000
AltTab_ID_List_ =0
WinGet, Window_List, List,,, Program Manager ; Gather a list of running programs
id_list =
Loop, %Window_List%
{
wid := Window_List%A_Index%
WinGetTitle, wid_Title, ahk_id %wid%
WinGet, Style, Style, ahk_id %wid%
If ((Style & WS_DISABLED) or ! (wid_Title)) ; skip unimportant windows
Continue
WinGet, es, ExStyle, ahk_id %wid%
Parent := Decimal_to_Hex( DllCall( "GetParent", "uint", wid ) )
WinGetClass, Win_Class, ahk_id %wid%
WinGet, Style_parent, Style, ahk_id %Parent%
If ((excludeToolWindows & (es & WS_EX_TOOLWINDOW))
or ((es & ws_ex_controlparent) and ! (Style & WS_POPUP) and !(Win_Class ="#32770") and ! (es & WS_EX_APPWINDOW)) ; pspad child window excluded
or ((Style & WS_POPUP) and (Parent) and ((Style_parent & WS_DISABLED) =0))) ; notepad find window excluded ; note - some windows result in blank value so must test for zero instead of using NOT operator!
continue
AltTab_ID_List_ ++
AltTab_ID_List_%AltTab_ID_List_% :=wid
}
AltTab_ID_List_0 := AltTab_ID_List_
}
-
Oops; our edits got crossed up. I tried to put Humpty Dumpty back together again; please check that your code is what you meant it to be. Feb 17, 2019 at 16:57
!`::
#`::
WinGet, ExeName, ProcessName, A
WinActivateBottom, ahk_exe %ExeName%
return
Simplified from @otter.pro's answer. This simply cycles backwards through the current application windows. Cycling forwards can cause brief flashes of other windows to appear. Since not seeing flashes is probably more important than bidirectional cycling, just don't cycle forwards. Furthermore, this answer allows #` as an alternative to !` since that's the key combination for the Mac shortcut.
Ctrl + Win + [Number] (Tested on Windows 10)
This is the closest built-in solution I managed to figure out.
Difference compared to the other answers:
When Win + [Number] is used without Ctrl, it always start from the first window, which is annoying/not what I really want most of the time.
No 3rd party software needed.
No mouse click needed.