这里的答案仅以沙伊斯为根据,按照欧佩斯的榜样,为每个屏幕形成结果。
PowerShell Code to format the results of: [System.Windows.Forms.Screen]::AllScreens
Add-Type -AssemblyName System.Windows.Forms
$screen_cnt = [System.Windows.Forms.Screen]::AllScreens.Count
$col_screens = [system.windows.forms.screen]::AllScreens
$info_screens = ($col_screens | ForEach-Object {
if ("$($_.Primary)" -eq "True") {$monitor_type = "Primary Monitor "} else {$monitor_type = "Secondary Monitor "}
if ("$($_.Bounds.Width)" -gt "$($_.Bounds.Height)") {$monitor_orientation = "Landscape"} else {$monitor_orientation = "Portrait"}
$monitor_type + "(Bounds) " + "$($_.Bounds)"
$monitor_type + "(Primary) " + "$($_.Primary)"
$monitor_type + "(Device Name) " + "$($_.DeviceName)"
$monitor_type + "(Bounds Width x Bounds Height) " + "$($_.Bounds.Width) x $($_.Bounds.Height) ($monitor_orientation)"
$monitor_type + "(Bits Per Pixel) " + "$($_.BitsPerPixel)"
$monitor_type + "(Working Area) " + "$($_.WorkingArea)"
}
)
Write-Host "TOTAL SCREEN COUNT: $screen_cnt"
$info_screens
Output for the secondary monitor in landscape mode. 1920 x 1200
# TOTAL SCREEN COUNT: 2
# Primary Monitor (Bounds) {X=0,Y=0,Width=2560,Height=1600}
# Primary Monitor (Primary) True
# Primary Monitor (Device Name) \.DISPLAY1
# Primary Monitor (Bounds Width x Bounds Height) 2560 x 1600 (Landscape)
# Primary Monitor (Bits Per Pixel) 32
# Primary Monitor (Working Area) {X=0,Y=0,Width=2560,Height=1560}
# Secondary Monitor (Bounds) {X=2560,Y=0,Width=1920,Height=1200}
# Secondary Monitor (Primary) False
# Secondary Monitor (Device Name) \.DISPLAY2
# Secondary Monitor (Bounds Width x Bounds Height) 1920 x 1200 (Landscape)
# Secondary Monitor (Bits Per Pixel) 32
# Secondary Monitor (Working Area) {X=2560,Y=0,Width=1920,Height=1160}
Output for the secondary monitor in portrait mode. 1200 x 1920
# TOTAL SCREEN COUNT: 2
# Primary Monitor (Bounds) {X=0,Y=0,Width=2560,Height=1600}
# Primary Monitor (Primary) True
# Primary Monitor (Device Name) \.DISPLAY1
# Primary Monitor (Bounds Width x Bounds Height) 2560 x 1600 (Landscape)
# Primary Monitor (Bits Per Pixel) 32
# Primary Monitor (Working Area) {X=0,Y=0,Width=2560,Height=1560}
# Secondary Monitor (Bounds) {X=2560,Y=0,Width=1200,Height=1920}
# Secondary Monitor (Primary) False
# Secondary Monitor (Device Name) \.DISPLAY2
# Secondary Monitor (Bounds Width x Bounds Height) 1200 x 1920 (Portrait)
# Secondary Monitor (Bits Per Pixel) 32
# Secondary Monitor (Working Area) {X=2560,Y=0,Width=1200,Height=1880}