๐Ÿง์šด์˜์ฒด์ œ/Windows

์œˆ๋„์šฐ - ํŒŒ์›Œ์‰˜๋กœ ๋ฐ”ํƒ•ํ™”๋ฉด ์Šคํฌ๋ฆฐ์ƒท ์บก์ฒ˜

Janger 2023. 2. 8. 00:48
728x90
[Reflection.Assembly]::LoadWithPartialName("System.Drawing")
function screenshot([Drawing.Rectangle]$bounds, $path) {
   $bmp = New-Object Drawing.Bitmap $bounds.width, $bounds.height
   $graphics = [Drawing.Graphics]::FromImage($bmp)

   $graphics.CopyFromScreen($bounds.Location, [Drawing.Point]::Empty, $bounds.size)

   $bmp.Save($path)

   $graphics.Dispose()
   $bmp.Dispose()
}

$bounds = [Drawing.Rectangle]::FromLTRB(0, 0, (Get-WmiObject -Class Win32_VideoController).CurrentHorizontalResolution, (Get-WmiObject -Class Win32_VideoController).CurrentVerticalResolution)
screenshot $bounds "./screenshot.png"

 

 

 

์ถœ์ฒ˜:

 

https://stackoverflow.com/questions/2969321/how-can-i-do-a-screen-capture-in-windows-powershell

 

How can I do a screen capture in Windows PowerShell?

How can I capture the screen in Windows PowerShell? I need to be able to save the screen to disk.

stackoverflow.com

 

https://stackoverflow.com/questions/7967699/get-screen-resolution-using-wmi-powershell-in-windows-7

 

Get Screen resolution using WMI/powershell in Windows 7

I am using the following script to get screen resolution in Windows using WMI. The script works fine when the computer is in landscape mode but returns incorrect values when in portrait mode. Works

stackoverflow.com

 

728x90