• EnglishSpanishGermanFrenchPolishChinese (Traditional)


EnglishSpanishGermanFrenchPolishChinese (Traditional)

Operating systems, scripting, PowerShell and security

Operating systems, software development, scripting, PowerShell tips, network and security

Menú principal
  • Categorías
  • Cursos
  • Libro de PowerShell
  • Lo mejor
  • Lo último
  • Proyectos
  • Contactar
Ir al contenido

Realizar una captura de pantalla en Windows con PowerShell (el nombre del fichero es añomesdiahoraminuto)

PowerShell
1
2
3
4
5
6
$path=(Get-Date).ToString("yyyyMMddhhmm")+"prueba.bmp"
$b=New-Object System.Drawing.Bitmap([System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Width, [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Height)
$g=[System.Drawing.Graphics]::FromImage($b)
$g.CopyFromScreen((New-Object System.Drawing.Point(0,0)), (New-Object System.Drawing.Point(0,0)), $b.Size)
$g.Dispose()
$b.Save($path,'Bmp')

Publicado el día 10 de abril de 2020

CATEGORÍAS

PowerShell

ETIQUETAS

Date, Drawing, Get-Date, Jesús Niño, Jesús Niño Camazón, New-Object, Path, Screen, size, System.Drawing, System.Drawing.Bitmap, System.Drawing.Graphics, System.Drawing.Point, ToString, Windows

MÁS

  • Abrir una página web con la cotización del IBEX 35 cada 20 minutos y hacer una captura de pantalla
  • Ejercicios de PowerShell: utilizar SendKeys en PowerShell
  • Proyectos e ideas: automatización
  • Convertir un script de PowerShell en un ejecutable de Windows (convertir un formulario en PowerShell)
  • Leer el contenido de un fichero que contiene bits
  • La "super" librería user32.dll