If you have multiple displays or an external projector, you might be familiar with the built-in feature of Windows 7 and Windows 8 to change the active display and the sharing mode of your current desktop. When you press Win+P, you can choose to extend your desktop, duplicate it, or turn off one of the displays entirely. It is possible to control this feature via the command line, so you can create a shortcut any of these 4 settings. Let's see how it can be done.
The built-in Windows utility, DisplaySwitch.exe, allows you to specify which display to use and how to use it.
It supports the following command line arguments:
The /internal argument is used to switch your PC to use the primary display only.
Tip: You can try these options right in the Run dialog. Open it with the Win + R shortcut and type the command above in the Run box.
Use this command to switch to the external display only.
Duplicates the primary display
Expands your Desktop to the secondary display
That's it. Now you can create a shortcut with the appropriate command.
You can assign a global keyboard shortcut as described in the article: Add global hotkeys to launch your favorite applications in Windows 8.1.