天天看點

安卓截屏shell腳本

寫個腳本,不需要每次截屏都在電腦上打開eclipse了

1.寫腳本

adb shell /system/bin/screencap -p /sdcard/download/screenshot.png

MM=`date +%s.png`

adb pull /sdcard/download/screenshot.png  /Users/BH/Pictures/com.tencent.ScreenCapture/$MM

擷取shell時間戳并當作檔案名,儲存到指定目錄下,很簡單很友善。

2.儲存到電腦裡(我用的是MAC),儲存為screenshot.sh

3.設定shell腳本的可執行權限, 用命名 sudo chmod u+x screenshot.sh

3.執行shell, 可以在指令行裡 /.screenshot.sh   , 這樣就可以成功截屏并儲存到電腦裡了。