Board logo

标题: [转载代码] PowerShell获取显示器尺寸大小(不是分辨率) [打印本页]

作者: HAT    时间: 2022-3-31 00:16     标题: PowerShell获取显示器尺寸大小(不是分辨率)

  1. function get-monitorsize {
  2. Get-WmiObject -Namespace root\wmi -Class WmiMonitorBasicDisplayParams |
  3. select  @{N="Computer"; E={$_.__SERVER}},
  4. InstanceName,
  5. @{N="Horizonal"; E={[System.Math]::Round(($_.MaxHorizontalImageSize/2.54), 2)}},
  6. @{N="Vertical"; E={[System.Math]::Round(($_.MaxVerticalImageSize/2.54), 2)}},
  7. @{N="Size";
  8. E={[System.Math]::Round(([System.Math]::Sqrt([System.Math]::Pow($_.MaxHorizontalImageSize, 2) `
  9. + [System.Math]::Pow($_.MaxVerticalImageSize, 2))/2.54),2)}}
  10. }
  11. get-monitorsize
复制代码
转自:
https://social.technet.microsoft.com/Forums/scriptcenter/en-US/620cacb9-25d8-4610-b30b-378ba4c6218c/get-monitor-size




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2