http://blog.csdn.net/justdb/article/details/8803934


环境

Eclipse Indigo + Android 2.2

 

问题

        Android模拟器中使用微信,微信好友向我发送图片,保存后想导出到电脑磁盘中。

 

解决

        使用adb pull命令。

[plain] view plain copy

  1. adb pull <remote> [<local>]  - copy file/dir from device  

  2.   

  3. adb pull 模拟器路径 [电脑磁盘路径,可选,不填表示导出到当前目录] –从设备中拷贝文件或者目录  


 

 

        比如从/sdcard/tencent/MicroMsg/Camera目录中导出图片到D盘,可以使用如下命令:

[plain] view plain copy

  1. adb pull /sdcard/tencent/MicroMsg/Camera D:\  


 

操作日志

[plain] view plain copy

  1. C:\Users\Wentasy>adb -help  

  2. Android Debug Bridge version 1.0.26  

  3.   

  4.  -d                            - directs command to the only connected USB devic  

  5. e  

  6.                                  returns an error if more than one USB device is  

  7.  present.  

  8.  -e                            - directs command to the only running emulator.  

  9.                                  returns an error if more than one emulator is r  

  10. unning.  

  11.  -s <serial number>            - directs command to the USB device or emulator w  

  12. ith  

  13.                                  the given serial number. Overrides ANDROID_SERI  

  14. AL  

  15.                                  environment variable.  

  16.  -p <product name or path>     - simple product name like 'sooner', or  

  17.                                  a relative/absolute path to a product  

  18.                                  out directory like 'out/target/product/sooner'.  

  19.   

  20.                                  If -p is not specified, the ANDROID_PRODUCT_OUT  

  21.   

  22.                                  environment variable is used, which must  

  23.                                  be an absolute path.  

  24.  devices                       - list all connected devices  

  25.  connect <host>[:<port>]       - connect to a device via TCP/IP  

  26.                                  Port 5555 is used by default if no port number  

  27. is specified.  

  28.  disconnect [<host>[:<port>]]  - disconnect from a TCP/IP device.  

  29.                                  Port 5555 is used by default if no port number  

  30. is specified.  

  31.                                  Using this ocmmand with no additional arguments  

  32.   

  33.                                  will disconnect from all connected TCP/IP devic  

  34. es.  

  35.   

  36. device commands:  

  37.   adb push <local> <remote>    - copy file/dir to device  

  38.   adb pull <remote> [<local>]  - copy file/dir from device  

  39.   adb sync [ <directory> ]     - copy host->device only if changed  

  40.                                  (-l means list but don't copy)  

  41.                                  (see 'adb help all')  

  42.   adb shell                    - run remote shell interactively  

  43.   adb shell <command>          - run remote shell command  

  44.   adb emu <command>            - run emulator console command  

  45.   adb logcat [ <filter-spec> ] - View device log  

  46.   adb forward <local> <remote> - forward socket connections  

  47.                                  forward specs are one of:  

  48.                                    tcp:<port>  

  49.                                    localabstract:<unix domain socket name>  

  50.                                    localreserved:<unix domain socket name>  

  51.                                    localfilesystem:<unix domain socket name>  

  52.                                    dev:<character device name>  

  53.                                    jdwp:<process pid> (remote only)  

  54.   adb jdwp                     - list PIDs of processes hosting a JDWP transport  

  55.   

  56.   adb install [-l] [-r] [-s] <file> - push this package file to the device and i  

  57. nstall it  

  58.                                  ('-l' means forward-lock the app)  

  59.                                  ('-r' means reinstall the app, keeping its data  

  60. )  

  61.                                  ('-s' means install on SD card instead of inter  

  62. nal storage)  

  63.   adb uninstall [-k] <package> - remove this app package from the device  

  64.                                  ('-k' means keep the data and cache directories  

  65. )  

  66.   adb bugreport                - return all information from the device  

  67.                                  that should be included in a bug report.  

  68.   

  69.   adb help                     - show this help message  

  70.   adb version                  - show version num  

  71.   

  72. DATAOPTS:  

  73.  (no option)                   - don't touch the data partition  

  74.   -w                           - wipe the data partition  

  75.   -d                           - flash the data partition  

  76.   

  77. scripting:  

  78.   adb wait-for-device          - block until device is online  

  79.   adb start-server             - ensure that there is a server running  

  80.   adb kill-server              - kill the server if it is running  

  81.   adb get-state                - prints: offline | bootloader | device  

  82.   adb get-serialno             - prints: <serial-number>  

  83.   adb status-window            - continuously print device status for a specifie  

  84. d device  

  85.   adb remount                  - remounts the /system partition on the device re  

  86. ad-write  

  87.   adb reboot [bootloader|recovery] - reboots the device, optionally into the boo  

  88. tloader or recovery program  

  89.   adb reboot-bootloader        - reboots the device into the bootloader  

  90.   adb root                     - restarts the adbd daemon with root permissions  

  91.   adb usb                      - restarts the adbd daemon listening on USB  

  92.   adb tcpip <port>             - restarts the adbd daemon listening on TCP on th  

  93. e specified port  

  94. networking:  

  95.   adb ppp <tty> [parameters]   - Run PPP over USB.  

  96.  Note: you should not automatically start a PPP connection.  

  97.  <tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1  

  98.  [parameters] - Eg. defaultroute debug dump local notty usepeerdns  

  99.   

  100. adb sync notes: adb sync [ <directory> ]  

  101.   <localdir> can be interpreted in several ways:  

  102.   

  103.   - If <directory> is not specified, both /system and /data partitions will be u  

  104. pdated.  

  105.   

  106.   - If it is "system" or "data", only the corresponding partition  

  107.     is updated.  

  108.   

  109. environmental variables:  

  110.   ADB_TRACE                    - Print debug information. A comma separated list  

  111.  of the following values  

  112.                                  1 or all, adb, sockets, packets, rwx, usb, sync  

  113. , sysdeps, transport, jdwp  

  114.   ANDROID_SERIAL               - The serial number to connect to. -s takes prior  

  115. ity over this if given.  

  116.   ANDROID_LOG_TAGS             - When used with the logcat option, only these de  

  117. bug tags are printed.  

  118.   

  119. C:\Users\Wentasy>cd D:  

  120. D:\  

  121.   

  122. C:\Users\Wentasy>D:  

  123.   

  124. D:\>adb pull /sdcard/tencent/MicroMsg/Camera D:\  

  125. pull: building file list...  

  126. pull: /sdcard/tencent/MicroMsg/Camera/mmexport1365840005829.jpg -> D:\/mmexport1  

  127. 365840005829.jpg  

  128. pull: /sdcard/tencent/MicroMsg/Camera/mmexport1365839981899.jpg -> D:\/mmexport1  

  129. 365839981899.jpg  

  130. pull: /sdcard/tencent/MicroMsg/Camera/mmexport1365839955299.jpg -> D:\/mmexport1  

  131. 365839955299.jpg  

  132. pull: /sdcard/tencent/MicroMsg/Camera/mmexport1365839940125.jpg -> D:\/mmexport1  

  133. 365839940125.jpg  

  134. 4 files pulled. 0 files skipped.  

  135. 45 KB/s (121750 bytes in 2.595s)  

  136.   

  137. D:\>  

  138.   

  139. D:\>dir  

  140.  Volume in drive D is LENOVO  

  141.  Volume Serial Number is BCCD-80BD  

  142.   

  143.  Directory of D:\  

  144.   

  145. 2013/04/13  16:13            30,560 mmexport1365839940125.jpg  

  146. 2013/04/13  16:13            29,325 mmexport1365839955299.jpg  

  147. 2013/04/13  16:13            30,643 mmexport1365839981899.jpg  

  148. 2013/04/13  16:13            31,222 mmexport1365840005829.jpg  


 

参考资料

        adb –help

 

总结

        1.多看帮助文档

        2.英语确实很重要,不用在网上查找任何资料,只要有帮助文档、参考手册很多问题都可以解决。