使用 adb 命令,在安卓手机截屏并保存到电脑上

Android 2021-12-19 阅读 477 评论 0

当电脑需要用到手机的截屏时,我们一般是使用手机自带的截屏功能截屏,再把图片发送到电脑。这里介绍另一种简单些的方法,使用 usb 连接手机,开启调试模式,再结合 adb 命令,直接把手机截屏图片存放在电脑。

使用 adb exec-out screencap

adb exec-out screencap -p > test.png

-p 表示生成 png 格式的文件。

注意,这个命令只有当运行没有错误的时候才生效。

使用 adb shell screencap

使用 adb shell screencap 生成截屏到手机的指定路径,再用 adb pull 将截屏图片复制到当前目录,最后运行 adb shell rm 删除手机的截图文件。

adb shell screencap /sdcard/Download/test.png
adb pull /sdcard/Download/test.png
adb shell rm /sdcard/Download/test.png
最后更新 2021-12-19