what is the default working directory for adb push

2019-04-28 09:08发布

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?

标签: android adb
3条回答
女痞
2楼-- · 2019-04-28 09:35

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\
查看更多
兄弟一词,经得起流年.
3楼-- · 2019-04-28 09:51

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.

查看更多
聊天终结者
4楼-- · 2019-04-28 09:58

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.

查看更多
登录 后发表回答