“将我的 Windows 桌面扩展到这台显示器上"以编程方式 [英] "Extend my Windows desktop onto this monitor" programmatically
问题描述
我希望能够通过代码设置将我的 Windows 桌面扩展到此显示器上".PowerShell 脚本将是理想的选择.WMI 似乎是前进的方向,但我对 WMI 的了解为零.
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.
推荐答案
Windows 7、8 和 10 应该附带一个执行此操作的小程序:displayswitch.exe.此页面列出了以下参数:
Windows 7, 8 and 10 are supposed to come with a small program that does exactly this: displayswitch.exe. This page lists the following parameters:
displayswitch.exe /internal Disconnect projector (same as "Show only on 1" from the Display Properties dialog)
displayswitch.exe /clone Duplicate screen
displayswitch.exe /extend Extend screen
displayswitch.exe /external Projector only (disconnect local) (same as "Show only on 2" from the Display Properties dialog)
要一键解决所提出的问题,只需创建一个包含单行的 *.bat 文件
For a one-click solution to the problem posed, simply create a *.bat-file containing the single line
call displayswitch.exe /extend
并将其保存到您的桌面.
and save it to your desktop.
[我在 Windows 8.1 上对此进行了测试,并已确认它可以在 Windows 10 上运行.]
[I tested this on Windows 8.1, and it has been confirmed to work on Windows 10.]
这篇关于“将我的 Windows 桌面扩展到这台显示器上"以编程方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!