How to "passthrough" a file from PC to Android and back using 'exec-in' and 'exec-out' directives? I can do this:

adb exec-in "gzip &gt; sdcard/test.gz" &lt; C:\test.txt
adb exec-out cat sdcard/test.gz &gt; C:\test.gz


The question is how to do something like this:

adb exec-in "gzip &gt; C:\test.gz" &lt; C:\test.txt


I mean, how can I use a file on my PC as an input for some android (linux) program and use another file on my PC as an output WITHOUT saving any data on android's internal memory (flash, microSD etc)?
My post is more a comment than an answer (but I cannot comment).
All my comments below address only the case of Windows adb host.
adb shell gzip &gt;C:\test.gz &lt;C:\test.txt probably works just because the input file is a text file.
adb shell gzip &gt;C:\test.gz &lt;C:\test.bin fails because the call of Windows read function in adb stops reading as soon as 0x1A byte (ctrl+Z) is read. This is the default text operation mode of the Windows read function.
The workaround uses by exec-in and exec-out is to call _setmode() to configure the writing and reading of file descriptors in binary mode.
Unfortunately most of the time &lt;test.bin adb exec-in &quot;cat - &gt; sdcard/test.bin&quot; fails as well for adbd version &lt; 1.0.41 (ie anything below android 10). The cause is probably some race condition issues in the usb.cpp code of adbd.
Android 10 fixes this with the nonblocking FFS implementation and &lt;test.bin adb exec-in &quot;cat - &gt; sdcard/test.bin&quot; works with Windows (tested with LineageOS 17.1 + Windows 10)