I can do it, without difficulty or elevated command prompts. This does require reasonable familiarity with the Windows Command Prompt shell commands. If you're trying to use commands as scripts without understanding them, you'll have trouble with this.
I start with a directory c:\android
with two subdirectories c:\android\bin
where I have put adb
and the rest of the platform tools, and c:\android\pushpull
for test data.
Set up PATH
c:\> PATH c:\android\bin;%PATH%
Create some test data
c:\> cd c:\android\pushpull
c:\android\pushpull> mkdir test
c:\android\pushpull> cd test
c:\android\pushpull\test> echo foo > foo.txt
c:\android\pushpull\test> echo bar > bar.txt
c:\android\pushpull> cd ..
Push it to the test area on the device
c:\android\pushpull> adb push test /data/local/tmp
Look on the device to check it's there:
c:\> adb shell
$ cd /data/local/tmp
$ ls -R
.:
test
./test:
bar.txt foo.txt
$ cat test/foo.txt
foo
$ cat test/bar.txt
bar
$ exit
Remove the Windows version of the test directory
c:\android\pushpull> rmdir /s /q test
Check it has gone
C:\android\pushpull>dir
Volume in drive C is Local Disk
Volume Serial Number is REDACTED
Directory of C:\android\pushpull
25/06/2023 14:25 <DIR> .
08/06/2023 20:25 <DIR> ..
Total Files Listed:
0 File(s) 0 bytes
2 Dir(s) REDACTED bytes free
Pull the Android copy back to the Windows machine
c:\android\pushpull> adb pull /data/local/tmp/test .
The second argument to adb pull
, which is just a ".", is the necessary detail.
Check the copy
C:\android\pushpull>dir /s test
Volume in drive C is Local Disk
Volume Serial Number is REDACTED
Directory of C:\android\pushpull\test
25/06/2023 14:25 <DIR> .
25/06/2023 14:25 <DIR> ..
25/06/2023 14:25 6 bar.txt
25/06/2023 14:25 6 foo.txt
2 File(s) 12 bytes
Total Files Listed:
2 File(s) 12 bytes
2 Dir(s) REDACTED bytes free
Notes
The key detail is realising that adb
is a UNIX-heritage program, and really prefers you to specify where the files you'll pulling (or pushing) are to go. Trying to default this doesn't work well. Google do their Android development on Linux, and tend to assume that if you're using adb at the command line you have some experience with shells and Linux.
Software versions
Windows 11 22H2, Android 13, Android Debug Bridge version 1.0.41 from Platform Tools version 34.0.3-10161052.