Search code examples
androidadb

what is the default working directory for adb push/pull and how do I change it?


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?


Solution

  • 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\