为什么我在 Windows 10 上的 PowerShell 中屏幕分辨率为空?
Why do I get empty for screen resolution in PowerShell on Windows 10?
我在 Get Screen resolution using WMI/powershell in Windows 7 中键入命令,但得到的结果是空的(我使用的是 Surface Pro 2017,单屏)?
我没有 Surface,但这有用吗?
Add-Type -AssemblyName System.Windows.Forms
$screen = [System.Windows.Forms.Screen]::PrimaryScreen
[pscustomobject]@{
DeviceName = $screen.DeviceName.Split('\')[-1]
Width = $screen.Bounds.Width
Height = $screen.Bounds.Height
BitsPerPixel = $screen.BitsPerPixel
}
编辑
使用CIM_VideoController
$screen = Get-CimInstance -ClassName CIM_VideoController
[pscustomobject]@{
DeviceName = $screen.Caption
Width = $screen.CurrentHorizontalResolution
Height = $screen.CurrentVerticalResolution
BitsPerPixel = $screen.CurrentBitsPerPixel
}
我在 Get Screen resolution using WMI/powershell in Windows 7 中键入命令,但得到的结果是空的(我使用的是 Surface Pro 2017,单屏)?
我没有 Surface,但这有用吗?
Add-Type -AssemblyName System.Windows.Forms
$screen = [System.Windows.Forms.Screen]::PrimaryScreen
[pscustomobject]@{
DeviceName = $screen.DeviceName.Split('\')[-1]
Width = $screen.Bounds.Width
Height = $screen.Bounds.Height
BitsPerPixel = $screen.BitsPerPixel
}
编辑
使用CIM_VideoController
$screen = Get-CimInstance -ClassName CIM_VideoController
[pscustomobject]@{
DeviceName = $screen.Caption
Width = $screen.CurrentHorizontalResolution
Height = $screen.CurrentVerticalResolution
BitsPerPixel = $screen.CurrentBitsPerPixel
}