I would like to be able to set \"Extend my Windows desktop onto this monitor\" via code. A PowerShell script would be ideal. WMI seems the way forward but I have zero knowle
2 lines in autohotkey
2nd display on:
RunWait C:\Windows\System32\DisplaySwitch.exe /extend
2nd display off:
RunWait C:\Windows\System32\DisplaySwitch.exe /internal
-
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#Persistent
Any1stKeyUWantToTurnOn::RunWait C:\Windows\System32\DisplaySwitch.exe /extend
Any2stKeyUWantToTurnOff::RunWait C:\Windows\System32\DisplaySwitch.exe /internal
or
You can check and try out my tool on github / BNK3R-Boy / DisplaySwitch. I published it right now.