打开终端,cd 到任意一个指定的目录,执行下面的命令即可

Shell命令

1
2
3
adb shell "/system/bin/screencap -p /sdcard/screenshot_tmp.png"
adb pull /sdcard/screenshot_tmp.png ./screenshot.png
adb shell "rm -r /sdcard/screenshot_tmp.png"

快捷调用

编辑 ~/.bash_profile 文件,加入如下语句,即可一键截图并保存到 桌面

1
alias screenshot='adb shell "/system/bin/screencap -p /sdcard/screenshot_tmp.png";file=`date +%Y-%m-%d_%H%M%S`;adb pull /sdcard/screenshot_tmp.png ~/Desktop/${file}.png;adb shell "rm -r /sdcard/screenshot_tmp.png"'