Wie macht man am besten einen Screenshot mit Batch/Powershell/Vbs/...?

2 Antworten

mit VBS kann man Tasten drücken. Dann kann man dann einen Screenshot machen

Woher ich das weiß:eigene Erfahrung – Mehrere Jahre Erfahrung mit Computern

Mausennahoj 
Beitragsersteller
 21.03.2020, 22:08

ja aber man kann den nicht unter einem bestimmten namen in einem bestimmten ordner speichern

0
Mausennahoj 
Beitragsersteller
 21.03.2020, 22:14

außerdem blinckt dann der bildschirm kurz auf, was ich auch nicht will

0

erstmal Quick &Dirty ohne große Erklärung (mein Mopie muß Gassi)

<# : batch portion
@echo off 
  rem Bildname !ohne Endung! (in dieser kleinen Schmutzigen Variante  nur PNGformat)
set "pictureFile=MyScrShot"


(for %%I in ("%~f0";"%pictureFile%.png";) do @echo:%%~I)|powershell -windowstyle hidden -noprofile "[Array]$argv = $input|?{$_}; iex (${%~f0}| out-string)"
exit /b
: end batch / begin powershell #>

[Reflection.Assembly]::LoadWithPartialName("System.Drawing")
function screenshot([Drawing.Rectangle]$bounds, $path) {
   $Bitmap = New-Object Drawing.Bitmap $bounds.width, $bounds.height
   $Screen = [Drawing.Graphics]::FromImage($Bitmap)
   $Screen.CopyFromScreen($bounds.Location, [Drawing.Point]::Empty, $bounds.size)
   $Bitmap.Save($path)
   $Screen.Dispose()
   $Bitmap.Dispose()
}

Get-WmiObject -Class Win32_VideoController|%{
    $ScreenWidth=$_.CurrentHorizontalResolution
    $ScreenHeight=$_.CurrentVerticalResolution
}

$bounds = [Drawing.Rectangle]::FromLTRB(0, 0, $ScreenWidth,$ScreenHeight)
screenshot $bounds $argv[1]
Woher ich das weiß:eigene Erfahrung – Ich mach das seit 30 Jahren