电脑通过ADB截图脚本
【摘自】https://blog.csdn.net/xiezhiming1234/article/details/82457431
bat脚本集合adb shell命令实现快速截屏,远比手机助手去截屏方便
首先新建一个txt文本文件,然后把以下内容复制粘贴到文本中,然后文件的后缀txt改为bat,就可以了
1 @ECHO OFF 2 ECHO.[快速手机截屏] 3 ECHO.------------------------------- 4 ECHO.手机截屏.... 5 adb shell screencap -p /sdcard/screen.png 6 ECHO.[Tips ] 拷贝截屏图片至电脑 7 adb pull /sdcard/screen.png "%~dp0\screen.png" 8 ren screen.png "%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%.png" 9 adb shell rm /sdcard/screen.png 10 ECHO [暂停2秒自动关闭...] 11 ping -n 2 127.0.0.1>nul 12 @ECHO ON
连续截屏多个可参考(未验证)
1 savepath=$(cd `dirname $0`; pwd) 2 function pause(){ 3 read -n 1 -p "$*" INP 4 if [ [$INP != ''] ] ; then 5 echo -ne '\b \n' 6 fi 7 } 8 9 adb wait-for-device 10 11 echo 'wait-for-device' 12 13 result=`adb devices` 14 15 ipAddr=${result#*attached} 16 ipAddr=${ipAddr%%device*} 17 ipAddr=${ipAddr:1:19} 18 echo $ipAddr 19 20 pause 'Press any key to continue...' 21 while true; 22 do 23 pause 'Press any key to continue' 24 DATE=`date +%Y%m%d%H%M%S` 25 adb -s ${ipAddr} shell screencap ./sdcard/screen_${DATE}.png 26 adb -s ${ipAddr} pull ./sdcard/screen_${DATE}.png ${savepath} 27 adb -s ${ipAddr} shell rm ./sdcard/screen_${DATE}.png 28 echo "save screen_${DATE}.png to ${savepath} success!" 29 done