可以试试这个行不行,保存路径自己修改- <# :
- @echo off
- powershell -NoProfile -ExecutionPolicy bypass "Get-Content -literal '%~f0' |Out-String|Invoke-Expression"
- #>
- Function Get-Screenshot($FilePath) {
- $ScreenBounds = [Windows.Forms.SystemInformation]::VirtualScreen
- $ScreenshotObject = New-Object Drawing.Bitmap $ScreenBounds.Width, $ScreenBounds.Height
- $DrawingGraphics = [Drawing.Graphics]::FromImage($ScreenshotObject)
- $DrawingGraphics.CopyFromScreen( $ScreenBounds.Location, [Drawing.Point]::Empty, $ScreenBounds.Size)
- $DrawingGraphics.Dispose()
- $ScreenshotObject.Save($FilePath)
- $ScreenshotObject.Dispose()
- }
- Add-Type -AssemblyName System.Windows.Forms
- Get-Screenshot -FilePath "C:\Users\Administrator\Desktop\2222.jpg"
复制代码
|