2
My desktop is extended in two monitors and I want to take screenshot of desktop of 2nd monitor from command line (cmd/powershell).
Any Idea?
2
My desktop is extended in two monitors and I want to take screenshot of desktop of 2nd monitor from command line (cmd/powershell).
Any Idea?
2
This (untested) PowerShell snippet can get you started. Remember that for an extended screen the pixel coordinates are continuous on both screens, from the left-most screen to the right-most:
$File = "\mypath\myscreenshot.bmp"
Add-Type -AssemblyName System.Windows.Forms
Add-type -AssemblyName System.Drawing
# Gather Screen resolution information
$Screen = [System.Windows.Forms.SystemInformation]::VirtualScreen
$Width = ..2nd monitor width in pixels..
$Height = ..2nd monitor height in pixels..
$Left = ..2nd monitor starting left pixel..
$Top = ..2nd monitor starting top pixel, normally zero..
# Create bitmap using the top-left and bottom-right bounds
$bitmap = New-Object System.Drawing.Bitmap $Width, $Height
# Create Graphics object
$graphic = [System.Drawing.Graphics]::FromImage($bitmap)
# Capture screen
$graphic.CopyFromScreen($Left, $Top, 0, 0, $bitmap.Size)
# Save to file
$bitmap.Save($File)
If it works then all is OK. If not, just post another question. – harrymc – 2019-03-23T19:00:01.450
1
Possible duplicate of Take a screen shot from command line in Windows
– Ahmed Ashour – 2019-03-04T14:30:48.593