Home > front end >  -p in powershell from adb
-p in powershell from adb

Time:04-27

Hey im trying to do a screenshot from "Mobilephone" from the terminal I can pull and push normally but when I use the command

.\adb exec-out screencap -p > ./pic3.png

The png cant open

CodePudding user response:

As of this writing (PowerShell 7.2.2), PowerShell's > operator is fundamentally incapable of capturing raw bytes (binary output) - see this answer for more information.

The simplest workaround is to call via cmd.exe, whose > operator does support raw byte streams:

cmd /c '.\adb exec-out screencap -p > .\pic3.png'

The alternative is to save the screenshot directly to a file on the Android device (syntax gleaned from here), and download it afterwards, as you show in your own answer.

./adb shell screencap ./pic3.png

CodePudding user response:

Ok if I use

.\adb shell screencap ./pic3.png

in shell, then I can pull it with

.\adb pull sdcard/download/pic3.png
  • Related