Output

48 views
Skip to first unread message

RGeB

unread,
Mar 28, 2026, 5:48:53 AM (5 days ago) Mar 28
to Automate for Android

Is there any way in Automate to view or save the results (output) of an adb shell (privileged shell) command like dumpsys power? I have tried commands dumpsys power > test.txt and dumpsys power > download/test.txt and dumpsys power > sdcard/test.txt, but I cannot find any such file.  ADB shell dumpsys power works in Win, and the Automate log shows no errors, so I assume my problem in Automate is on the output side. I cannot find anything relevant on “output” in the Automate documentation or forum.


Henrik "The Developer" Lindqvist

unread,
Mar 28, 2026, 11:33:59 AM (4 days ago) Mar 28
to Automate for Android
Assign the Standard output text variable a then use the File write block, e.g.:
  1. Flow beginning
  2. Shell command privileged: Command line=dumpsys power, Standard output text=stdout
  3. File write: File=<click to pick>, Content=stdout
As for piping, as the documentation say, "Currently the command isn’t executed in actual shell, e.g. bash, so built-in commands without stand-alone executables like cd, echo and test may not work, nor may “piping”, e.g. | or >, without wrapping the command in sh -c "command""

RGeB

unread,
Mar 28, 2026, 8:35:56 PM (4 days ago) Mar 28
to Automate for Android
Thanks, but this gives a file containing one word: stdout. I must be missing something. Any suggestions?

(Not sure what is meant by:  wrapping the command in sh -c "command""; so I have not tried that.)

Henrik "The Developer" Lindqvist

unread,
Mar 28, 2026, 8:43:22 PM (4 days ago) Mar 28
to Automate for Android
In the Content field, click the fx button then type in the variable name. Please read:

To use piping, i.e. > you need to wrap the command line like:
sh -c "dumpsys > test.txt"

RGeB

unread,
Mar 29, 2026, 7:12:41 PM (3 days ago) Mar 29
to Automate for Android
Thanks again. Both ways work. 

In case anyone else is dumb like me (I would never have worked it out from the Documentation) the methods are:

Either
  1. Flow beginning
  2. Shell command privileged:: Input arguments, Command line=dumpsys power; Output variables, Standard output text=stdout
  3. File write:: File=<click to pick, eg Download/test.txt > (requires granting write permission); In Content,  click the fx button then type in stdout (don't use " ")
Or
  1. Flow beginning
  2. Shell command privileged:: Command line=sh -c "dumpsys power >test.txt"

The files may go to different places, but you can find them using a capable file manager (like MiX).
Reply all
Reply to author
Forward
0 new messages