58

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?

2

16 Answers 16

59

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.

6
  • 1
    This doesn't seem to work on a multi screen setup where you extend the taskbar
    – Erfan
    Feb 20, 2015 at 3:35
  • 1
    Great. And Win+Shift+1 cycles through windows reversely. Jan 10, 2018 at 13:23
  • 1
    Windows 10 users, see my answer below (Ctrl+Win+Number). Not sure if it works on Win 7/8.
    – Taylan
    Dec 29, 2019 at 13:43
  • 2
    If you hold control at the same time (ctrl+win+n), you can switch between windows instantly without showing the thumbnail
    – ZYinMD
    Jul 28, 2020 at 16:11
  • Verified, this works on windows 11 too.
    – sh87
    May 4, 2022 at 1:12
28

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.)

7
  • 2
    HUGE 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.
    – bpcookson
    Sep 8, 2015 at 11:43
  • 1
    VistaSwitcher is beautiful. Thanks for the suggestion. Mar 9, 2016 at 19:34
  • You can also add items to the exclude list like the "New notification" and "Cortana" on Windows 10.
    – dragon788
    May 29, 2016 at 23:02
  • 1
    i love vista switcher program.
    – Luke
    Oct 24, 2016 at 8:28
  • 1
    looks like the successor to vistaswitcher, which is named alt-tab terminator doesn't have the feature to tab between same application anymore
    – starcorn
    May 7, 2019 at 8:00
23

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

7
  • 2
    This 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.)
    – Kirk Woll
    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...
    – Seperman
    Mar 9, 2016 at 18:53
  • Great job, used it right away, thanks. A few points: WinGet, List returns the number of windows in the List variable (as opposed to the List%n% pseudoarray in which the handles are stored), so you can skip the WinGet, WinClassCount call and check for List instead. Also, the code seems to be identical for both hotkeys.
    – Lebenita
    Sep 1, 2016 at 7:01
  • it's doens't work with me on Windows 10 64bit and Microsoft Office 2016. can you help ?
    – Luke
    Oct 24, 2016 at 8:23
  • 1
    This 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.
    – petr
    Nov 23, 2016 at 18:36
11

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.

5
  • 1
    Cool. 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.
    – Seperman
    Oct 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.
    – Ghos3t
    Mar 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.
    – otter.pro
    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
  • Any idea why it doesn't work in Explorers?
    – ZYinMD
    Jul 28, 2020 at 0:17
9

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.

2
  • 1
    doesnt "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
  • Ok, I like this app the best.
    – aerin
    Jun 5, 2021 at 21:32
7

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.

1
6

I created an AutoHotkey script to switch between same application's windows that work with regular Window Apps, Chrome Shortcuts and Chrome Apps.

https://github.com/JuanmaMenendez/AutoHotkey-script-Open-Show-Apps/blob/master/AutoHotkey-script-Switch-Windows-same-App.ahk

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/")
2
  • 3
    This 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)
    – otter.pro
    Jul 29, 2019 at 15:24
  • 3
    This 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
4

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.

1
  • 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)?
    – Lebenita
    Sep 1, 2016 at 5:24
4

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
1
  • 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.
    – lepsch
    Aug 19, 2021 at 10:59
1

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
  • 1
    (this answer already given by another user)
    – Pete Alvin
    May 15, 2018 at 14:07
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
1
!`::
#`::
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.

1

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.

1
1

If you don't want to bother with autohotkeys just for this particular task, I've found an app that does the job: https://github.com/sigoden/window-switcher (I'm not affiliated with it in any way). Like it better than Easy Windows Switcher from Neosmart since it's open source and configurable (e.g. you can change key combo to your liking).

0

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:

!`::
{
   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_
}

1
  • 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
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .