Skip to content

Instantly share code, notes, and snippets.

@ctrl-freak
Created August 2, 2017 01:00
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 ctrl-freak/3844cc4be139b8760cd689501b95e3e2 to your computer and use it in GitHub Desktop.
Save ctrl-freak/3844cc4be139b8760cd689501b95e3e2 to your computer and use it in GitHub Desktop.
Pull Screenshot from Android through ADB with DateTime Filename
@echo off
rem https://stackoverflow.com/questions/7727114/batch-command-date-and-time-in-file-name
rem %I if running in Command Prompt, %%I is for batch
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do @set datetime=%%I
set datetime=%datetime:~0,8%-%datetime:~8,6%
set filename=screen_%datetime%.png
rem https://blog.shvetsov.com/2013/02/grab-android-screenshot-to-computer-via.html
adb shell screencap -p /sdcard/%filename%
adb pull /sdcard/%filename%
adb shell rm /sdcard/%filename%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment