我正在尝试通过脚本(Powershell)设置屏幕分辨率.我找到了cmdlet Set-DisplayResolution,它应该适用于Server 2012/R2和8/8.1(它不起作用),并且它也无法在Windows 10 PS 5.0上运行.
我也看过了
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Screen]::AllScreens
Run Code Online (Sandbox Code Playgroud)
和
[System.Windows.Forms.Screen]::PrimaryScreen
Run Code Online (Sandbox Code Playgroud)
但它显示了奇怪的输出:
BitsPerPixel : 32
Bounds : {X=0,Y=0,Width=2000,Height=1333}
DeviceName : \\.\DISPLAY1
Primary : True
WorkingArea : {X=0,Y=0,Width=2000,Height=1293}
Run Code Online (Sandbox Code Playgroud)
我正在运行3000x2000分辨率.即使我将显示器更改为1920x1080,输出也保持不变.
经过长时间的搜索后,我找到了这个脚本,它使用win32 API完成了这项工作.有没有更方便的方法来执行此操作,因为这Set-DisplayResolution只是在Windows 10安装上运行?
我还想设置Windows 10的UI缩放(如150%).当然,我想知道,为什么这些AllScreens和PrimaryScreen方法[System.Windows.Forms.Screen]不能正常运作.
powershell ×1