android adb 截图 & 录屏 & log bat脚本
rem adb wait-for-device adb root adb remount @echo off for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a" set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%" set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%" set "datestamp=%YYYY%%MM%%DD%" & set "timestamp=%HH%%Min%%Sec%" set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%" rem echo datestamp: "%datestamp%" rem echo timestamp: "%timestamp%" rem echo fullstamp: "%fullstamp%" adb shell /system/bin/screencap -p /sdcard/screenshot.png rem adb pull /sdcard/screenshot.png ./screenshot_%datestamp%%timestamp%.png adb pull /sdcard/screenshot.png ./screenshot_%fullstamp%.png pause exit
ADB LOG抓取带时间戳脚本:
::adb root ::adb remount @echo off for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a" set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%" set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%" set "datestamp=%YYYY%%MM%%DD%" & set "timestamp=%HH%%Min%%Sec%" set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%" :: echo datestamp: "%datestamp%" :: echo timestamp: "%timestamp%" :: echo fullstamp: "%fullstamp%" ::adb logcat -b main -b radio -b system -b events -v time -> f:\my_log.txt ::adb logcat -b threadtime all 2>&1 > .\log.txt ::adb shell cat /proc/kmsg > kmsg.txt ::adb logcat -b all 2>&1 > .\adbLog_%datestamp%%timestamp%.txt @echo on ::adb logcat -G 200M adb logcat -b all 2>&1 > .\adbLog_%fullstamp%.txt ::adb logcat -v threadtime -b radio -b main > adblog.txt
android adb 录屏命令:
#开始录屏命令:
adb shell screenrecord /sdcard/launch.mp4
#设置给定的分辨率 --size
adb shell screenrecord --size 1280*720 /sdcard/launch.mp4
#设置给定的比特率 --bit-rate
adb shell screenrecord --bit-rate 6000000 /sdcard/launch.mp4
#导出录屏MP4
adb pull /sdcard/demo.mp4 D:/
限制录制时间:
参数: --time-limit
adb shell screenrecord --time-limit 10 /sdcard/demo.mp4
在命令行显示log
参数: --verbose
adb shell screenrecord --time-limit 10 --verbose /sdcard/demo.mp4
旋转90度
参数: --rotate
查看帮助命令
参数: --help
refs:
https://blog.csdn.net/m0_66144910/article/details/122578548