“Extend my Windows desktop onto this monitor” prog

2020-02-17 07:22发布

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 knowledge in WMI.

8条回答
混吃等死
2楼-- · 2020-02-17 08:05

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.

查看更多
Emotional °昔
3楼-- · 2020-02-17 08:07

windows key + P button will do the same thing

查看更多
登录 后发表回答