Skip to content

Instantly share code, notes, and snippets.

@DexterHaslem
Created October 8, 2016 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DexterHaslem/afb998460fcdc972386afee019ee324d to your computer and use it in GitHub Desktop.
Save DexterHaslem/afb998460fcdc972386afee019ee324d to your computer and use it in GitHub Desktop.
#expects platform tools in path (usually like AppData\Local\Android\sdk\platform-tools)
$ts = [int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalMilliseconds
$file = "image$ts.png"
if ($args[0])
{
$destdir = $args[0]
}
else
{
$destdir = $pwd.Path
}
$dest = join-path $destdir $file
# while screencap does write to STDOUT, adb converts newlines (COOL) corrupting data
adb shell screencap -p /sdcard/$file
adb pull /sdcard/$file $dest
adb shell rm /sdcard/$file
# debug
#$f = Read-Host "done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment