what is the default working directory for adb push

2019-04-28 09:18发布

问题:

I pulled out a file from the android sdcard using adb and it seems it goes to c:\documents and settings\userName by default. I don't know how it got set to this folder since this is not where adb is installed, but probably has got something to do with the fact that both the workspace and .android folders are located here. How do I change this default location for pull command of adb?

回答1:

The default directory for adb pull or adb push seems to be the current directory (aka . ). If you issue a command such as the following, not specifying the target directory

adb pull /boot.txt

the file (provided it exists) will be copied to the current directory.

Windows users:

Take notice of the following: If you are using Windows (Vista or newer), chances are that if the current directory requires elevated privileges to write on, Windows will silently replicate the directory structure of your current directory in a special folder called VirtualStore and will copy your files in it.

The full path for VirtualStore is: %LOCALAPPDATA%\VirtualStore, which most likely will translate into C:\Users\<account_name>\AppData\Local\VirtualStore.

So, in the following scenario,

C:\> cd "C:\Program Files (x86)\MyCustomADBInstallLocation"
C:\Program Files (x86)\MyCustomADBInstallLocation> adb pull /boot.txt

your file boot.txt will end up in this folder

C:\Users\<account_name>\AppData\Local\VirtualStore\Program Files (x86)\MyCustomADBInstallLocation\


回答2:

you can mention the destination location for adb push/pull, see example:-

adb push a.txt /data/local

adb pull /data/local/a.txt .

. means present directory.

or

adb pull /data/local/a.txt C:\

Hope this helps.



回答3:

i'm using linux, and noticed that if i opened the terminal as root, its opened @ home. when i pull items, it dumps to that repository, meaning to my "home" directory. will try opening terminal in a different folder and running adb pull from there to see if that makes the files dump to the folder terminal is opened in.



标签: android adb