37

I have my Windows 10 desktop computer connected to two displays through HDMI - one monitor and one TV, which I can toggle through with Windows Key+P as described in the accepted answer to this question.

However, I was wondering if there was some hotkey, shortcut, or button combination I could use sort of like a "Virtual KVM Switch" that lets me select one display or another specifically, without needing to cycle/toggle through other displays.

5 Answers 5

50

The built-in DisplaySwitch.exe tool can emulate the WindowsKey + P capabilities. You can potentially create four desktop shortcuts so that you have one available for each option:

For the PC screen only: %windir%\System32\DisplaySwitch.exe /internal

For Duplicate: %windir%\System32\DisplaySwitch.exe /clone

For Extend: %windir%\System32\DisplaySwitch.exe /extend

For Second screen only: %windir%\System32\DisplaySwitch.exe /external

(Source)

2
  • Well this is just fantastic! It does exactly what I asked for, and I bet I can map it to a key somehow.
    – dotVezz
    Jan 3, 2017 at 0:16
  • It depends upon how much time you want to devote to it. Many people use AutoHotKey for things like that, and their community often has scripts or templates available that you can use to get started in the right direction.
    – Run5k
    Jan 3, 2017 at 0:36
23

WindowsKey + P toggles three modes:

  1. Local only
  2. Local + External (TV) -- duplicated
  3. Local + External (TV) -- extended

My advise is to leave things set at #3 most of the time.

In this mode, all of your screens are always available. The keyboard will use whatever has the focus, regardless of which display you're looking at, and the mouse cursor will easily move back and forth.

That would still be a hassle, except you can also easily move individual programs between displays using these shortcuts:

WindowsKey + Shift + 🡺 (right arrow)
WindowsKey + Shift + 🡸 (left arrow)

So you can queue up something on your internal display, and then easily push it to the TV without losing access to the internal display.

If the left and right arrows seem backwards from your actual setup, you can adjust the monitor layout in display properties.

1
  • 1
    to stay in extended mode can have a side effect, if you have two monitors of different geometry: the mouse can occasionally get sort of trapped in a corner of the wider one, cause if you involountarily move it there and get out of the borders of the smaller one, you cannot move it back unless you align the mouse to the borders of the smaller one. I use a 4K monitor (top) and a 2K laptop (bottom): vertically oriented and aligned left, if I move the mouse on the right side above it can't get back by just sliding down. When the 4K monitor is off, understanding where your mouse is, is unintuitive. Oct 8, 2020 at 6:21
3

Based on Run5k's answer, I created an AutoHotKey script.

Ctrl+PgUp for PC screen and Ctrl+PgDn for the second screen.

^PgUp::
Run, C:\Windows\System32\DisplaySwitch.exe /internal
return

^PgDn::
Run, C:\Windows\System32\DisplaySwitch.exe /external
return
1

Little PowerShell script to toggle (using build in Windows DisplaySwitch.exe) between 'extend' and 'internal/primary' screen every time the script is executed. You can easilly convert the ps1 script into exe using ps2exe-gui tool.

DisplaySwitchToggle.ps1:

Add-Type -AssemblyName System.Windows.Forms
$SEL = [System.Windows.Forms.Screen]::AllScreens | Select-String -Pattern "DISPLAY2"
if ($SEL -ne $null)
{
   <# display2 found, so assuming already extended, switch to internal #>
   & DisplaySwitch.exe /internal
}
else
{
   <# display2 NOT found, so not extended, switch to extend #>
    & DisplaySwitch.exe /extend
}
0

Once you have created a shortcut on the desktop you can right click, Choose properties, select the Shortcut tab. There should be a box labeled Shortcut. It should say none in the box. If you click the box that says none and hold control (auto selects control + Alt) and choose a key you can make a keyboard shortcut. I chose Ctrl+alt+S for PC screen, and Ctrl+alt+D for my second TV. It sounds complicated but you really just right click, select properties and Choose a keyboard shortcut. Super easy.

2
  • 1
    This does not answer OPs question. They aren't asking how to run a shortcut with a key combination, they are asking how to select a different physical or virtual desktop using a key combination. The existing answers already answer this correctly. Jun 1, 2018 at 21:17
  • This does work, you just need to make it clear that you're building ontop of @Run5k's answers. Bonus, you don't need to download AHK. tnx m8.
    – Fydo
    Apr 12, 2022 at 13:11

You must log in to answer this question.

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