Skip to content

Instantly share code, notes, and snippets.

@Gizmodo
Created February 18, 2025 11:46
Show Gist options
  • Save Gizmodo/092b8f096624b676b85b5d45805111ab to your computer and use it in GitHub Desktop.
Save Gizmodo/092b8f096624b676b85b5d45805111ab to your computer and use it in GitHub Desktop.
Take Android screenshot and write it to datetime filename
@echo off
set SCREENCAP_FILE_PREFIX=screenshot
set SCREENCAP_WORKING_DIR=/sdcard/
set shortTime=%time:~0,8%
set shortTime=%shortTime: =0%
set SCREENCAP_FILE_NAME=screenshot_%date:-=%_%shortTime::=%.png
set SCREENCAP_FILE_PATH=%SCREENCAP_WORKING_DIR%%SCREENCAP_FILE_NAME%
adb shell screencap -p %SCREENCAP_FILE_PATH%
adb pull %SCREENCAP_FILE_PATH%
adb shell rm %SCREENCAP_FILE_PATH%
echo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment