Wenn man einen Screenshot automatisch vom Bildschirm erstellen möchte, kann man das mit PowerShell komfortabel lösen.
Add-Type -AssemblyName System.Drawing
function Take-Screenshot {
$screenWidth = [System.Windows.Forms.SystemInformation]::PrimaryMonitorSize.Width
$screenHeight = [System.Windows.Forms.SystemInformation]::PrimaryMonitorSize.Height
$bitmap = New-Object System.Drawing.Bitmap $screenWidth, $screenHeight
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
$graphics.CopyFromScreen(0, 0, 0, 0, $bitmap.Size)
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
$filePath = "C:\Screenshots\Screenshot_$timestamp.png"
$bitmap.Save($filePath, [System.Drawing.Imaging.ImageFormat]::Png)
$graphics.Dispose()
$bitmap.Dispose()
return $filePath
}
if (-not (Test-Path "C:\Screenshots")) {
New-Item -ItemType Directory -Path "C:\Screenshots"
}
while ($true) {
Take-Screenshot
Start-Sleep -Seconds 60
}Den Ordner kann man natürlich anpassen, und wer nur einmalig einen Screenshot braucht, kann das Intervall weglassen.
Add-Type -AssemblyName System.Drawing
$screenWidth = [System.Windows.Forms.SystemInformation]::PrimaryMonitorSize.Width
$screenHeight = [System.Windows.Forms.SystemInformation]::PrimaryMonitorSize.Height
$bitmap = New-Object System.Drawing.Bitmap $screenWidth, $screenHeight
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
$graphics.CopyFromScreen(0, 0, 0, 0, $bitmap.Size)
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
$filePath = "C:\Screenshots\Screenshot_$timestamp.png"
$bitmap.Save($filePath, [System.Drawing.Imaging.ImageFormat]::Png)
$graphics.Dispose()
$bitmap.Dispose()
return $filePath