android 屏幕截取,pull到pc端

1、当需要截取手机屏幕时,进行批命令点击,截取adb pull到电脑端,或者进行接口上传到服务器。

GetScreen.bat

 1 @ECHO OFF
 2 
 3 :: read config.cfg
 4 SETLOCAL ENABLEDELAYEDEXPANSION
 5 FOR /f "delims=" %%a IN ('TYPE "configconfig.cfg"^| FIND /i "="') DO (
 6   SET %%a
 7 )
 8 
 9 ::SET HOST=%host%
10 ::SET PORT=%port%
11 ::SET SCREENPATH=%screenpath%
12 ::SET SCREENNAME=%screenname%
13 
14 ::MKDIR %SCREENPATH%
15 
16 @set ip_port=192.168.11.200:5555
17 :DefauleExec
18     ECHO - connect %HOST%
19     adb connect %ip_port%
20     ::ECHO - creating %NAME%
21     adb -s %ip_port% shell screencap /sdcard/%SCREENNAME%
22     adb -s %ip_port% pull /sdcard/%SCREENNAME% %SCREENPATH%\%SCREENNAME%
23     ::ECHO - disconnect %HOST%
24     ::adb disconnect %HOST%
25     GOTO Finish
26 
27 :Finish
28 PAUSE

//新建 config 目录,在config目录下新建文件:config.cfg

 1 ##
 2 ## device config
 3 ##
 4 host=437fb41703806144
 5 port=
 6 
 7 ##
 8 ## screen raw config
 9 ##
10 screenpath=./screen
11 screenname=screen.png
12 
13 ##
14 ## roi save path
15 ##
16 savepath=./save
17 
18 ##
19 ## android sdk config
20 ##
21 ##android=D:/Program_Files/android-sdk
原文地址:https://www.cnblogs.com/CharlesGrant/p/4039973.html