In an AHK script, I'm trying to redirect the binary output from adb to a file. adb exec-out screencap -p > Screenshot.png
However, it looks like AHK's RunWait
doesn't really handle binary output.
How can I make this work?
I've toyed around with StdoutToVar and CMDRet, but don't really know what I'm doing.
In an AHK script, I'm trying to redirect the binary output from adb to a file. adb exec-out screencap -p > Screenshot.png
However, it looks like AHK's RunWait
doesn't really handle binary output.
How can I make this work?
I've toyed around with StdoutToVar and CMDRet, but don't really know what I'm doing.
Share Improve this question asked Mar 22 at 20:53 hoytdjhoytdj 1643 silver badges14 bronze badges 3 |1 Answer
Reset to default 0As Robert suggest it was just a matter of properly quoting. Here's what ended up working.
command := """" . adbPath . """ -s " . deviceAddress . " exec-out screencap -p > """ . outputFile . """"
RunWait, %ComSpec% /c "%command%", , Hide
cmd.exe /c adb exec-out ... > Screenshot.png
You may need to do some experiments to find the correct quoting for the redirect to screenshot.png part to be executed on PC side in cmd. – Robert Commented Mar 23 at 0:04runWait, %ComSpec% /c adb exec-out screencap -p > Screenshot.png
. When I run the same command directly in the windows terminal, it works fine. When I run it via runWait, the file is corrupt. – hoytdj Commented Mar 23 at 2:05