1、当需要截取手机屏幕时,进行批命令点击,截取adb pull到电脑端,或者进行接口上传到服务器。
GetScreen.bat
@ECHO OFF :: read config.cfg
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /f "delims=" %%a IN ('TYPE "config\config.cfg"^| FIND /i "="') DO (
SET %%a
) ::SET HOST=%host%
::SET PORT=%port%
::SET SCREENPATH=%screenpath%
::SET SCREENNAME=%screenname% ::MKDIR %SCREENPATH% @set ip_port=192.168.11.200:5555
:DefauleExec
ECHO - connect %HOST%
adb connect %ip_port%
::ECHO - creating %NAME%
adb -s %ip_port% shell screencap /sdcard/%SCREENNAME%
adb -s %ip_port% pull /sdcard/%SCREENNAME% %SCREENPATH%\%SCREENNAME%
::ECHO - disconnect %HOST%
::adb disconnect %HOST%
GOTO Finish :Finish
PAUSE
//新建 config 目录,在config目录下新建文件:config.cfg
##
## device config
##
host=437fb41703806144
port= ##
## screen raw config
##
screenpath=./screen
screenname=screen.png ##
## roi save path
##
savepath=./save ##
## android sdk config
##
##android=D:/Program_Files/android-sdk