windows环境下cmd运行monkeyrunner的环境变量,自己配置就好了
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\abc>d:
D:\>cd abcide
D:\abcIDE>cd sdk\tools
D:\abcIDE\sdk\tools>monkeyrunner
Jython 2.5.3 (2.5:c56500f08d34+, Aug 13 2012, 14:54:35)
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.7.0_21
>>> import sys
>>> from com.android.monkeyrunner import MonkeyRunner as mr
>>> from com.android.monkeyrunner import MonkeyDevice as md
>>> from com.android.monkeyrunner import MonkeyImage as mi
>>> device=mr.waitForConnection()
>>>
>>>
>>> device.shell("ls -l /data")
u'-rw------- system system 131072 2014-01-01 00:10 3D.bin\r\ndrwxrwx--- bluetooth net_bt 2014-01-01 00:00 @btmtk\r\n-rw-rw-r-- nvram nvram
64 2014-05-13 10:11 BT_Addr\r\ndrwxrwx--- system system 2014-05-13 10:11 acdapi\r\ndrwxrwx--x gps system 2014-05-13 10:11 a
gps_supl\r\ndrwxrwx--- system system 2014-05-13 10:11 amit\r\ndrwxrwxr-x system system 2014-01-01 00:02 anr\r\ndrwxrwx--x system sys
tem 2014-01-01 00:00 app\r\ndrwx------ root root 2014-05-13 10:11 app-asec\r\ndrwxrwx--x system system 2014-01-01 00:00
app-lib\r\ndrwxrwx--x system system 2014-05-13 10:11 app-private\r\ndrwx------ system system 2014-05-13 10:12 backup\r\ndrwxrwx--x sy
stem system 2014-01-01 00:01 dalvik-cache\r\ndrwxrwx--x system system 2014-01-01 00:00 data\r\ndrwxr-x--- root log 2
014-05-13 10:11 dontpanic\r\ndrwxrwxr-- drm system 2014-05-13 10:11 drm\r\ndrwxr-x--x root root 2014-05-13 10:11 local\r\ndrwxr
wx--- root root 1970-01-01 08:00 lost+found\r\n---------- root root 0 2014-05-13 10:11 lowmemdetect\r\ndrwxrwxr-x shell shell
2014-05-13 10:11 mdl\r\ndrwxrwx--- media_rw media_rw 2014-05-13 10:11 media\r\ndrwxrwxr-x media media 2014-05-13 10:11 medi
aserver\r\ndrwxrwx--t system misc 2014-05-13 10:11 misc\r\ndrwxrwx--- root nvram 2014-05-13 10:11 nvram\r\n-rw------- system sy
stem 4194304 2014-01-01 00:00 piggybank\r\ndrwx------ root root 2014-01-01 05:12 property\r\ndrwxrwx--x system system 2014-05-1
3 10:11 resource-cache\r\ndrwxr-x--- nvram system 2014-05-13 10:11 sec\r\ndrwx--x--x system system 2014-05-13 10:11 security\r\ndrwxr
-x--- root shell 2014-05-13 10:11 ssh\r\ndrwxrwxr-x system system 2014-01-01 05:14 system\r\ndrwx--x--x system system
2014-05-13 10:11 user\r\n'
>>> device.shell("ls /data")
u'3D.bin\r\n@btmtk\r\nBT_Addr\r\nacdapi\r\nagps_supl\r\namit\r\nanr\r\napp\r\napp-asec\r\napp-lib\r\napp-private\r\nbackup\r\ndalvik-cache\r\ndata\r\ndontpanic\
r\ndrm\r\nlocal\r\nlost+found\r\nlowmemdetect\r\nmdl\r\nmedia\r\nmediaserver\r\nmisc\r\nnvram\r\npiggybank\r\nproperty\r\nresource-cache\r\nsec\r\nsecurity\r\ns
sh\r\nsystem\r\nuser\r\n'
>>> device.shell("ls -l")
u'drwxr-xr-x root root 2014-05-13 10:11 acct\r\ndrwxrwx--- system cache 2014-01-01 00:00 cache\r\ndr-x------ root root
2014-05-13 10:11 config\r\ndrwxr-xr-x root root 2014-05-13 10:11 custom\r\nlrwxrwxrwx root root 2014-05-13 10:11 d -> /
sys/kernel/debug\r\ndrwxrwx--x system system 2014-01-01 00:00 data\r\n-rw-r--r-- root root 237 1970-01-01 08:00 default.prop\r\ndrwxr-
xr-x root root 2014-05-13 10:11 dev\r\nlrwxrwxrwx root root 1970-01-01 08:00 emmc@android -> /dev/block/mmcblk0p5\r\nlrwxrwxrw
x root root 1970-01-01 08:00 emmc@android2 -> /dev/block/mmcblk0p6\r\nlrwxrwxrwx root root 1970-01-01 08:00 emmc@cache -> /dev
/block/mmcblk0p7\r\n-rw-r--r-- root root 0 2014-05-13 10:11 emmc@custom\r\nlrwxrwxrwx root root 1970-01-01 08:00 emmc@ebr1 -> /d
ev/block/mmcblk0p1\r\nlrwxrwxrwx root root 1970-01-01 08:00 emmc@fat -> /dev/block/mmcblk0p9\r\nlrwxrwxrwx root root 1970-01-0
1 08:00 emmc@protect_f -> /dev/block/mmcblk0p2\r\nlrwxrwxrwx root root 1970-01-01 08:00 emmc@protect_s -> /dev/block/mmcblk0p3\r\nlrwxrwxrwx ro
ot root 1970-01-01 08:00 emmc@sec_ro -> /dev/block/mmcblk0p4\r\nlrwxrwxrwx root root 1970-01-01 08:00 emmc@usrdata -> /dev/blo
ck/mmcblk0p8\r\n-rw-r--r-- root root 127 1970-01-01 08:00 enableswap.sh\r\nlrwxrwxrwx root root 2014-05-13 10:11 etc -> /system/et
c\r\n-rw-r--r-- root root 12223 1970-01-01 08:00 factory2_init.rc\r\n-rw-r--r-- root root 2442 1970-01-01 08:00 factory_init.project.rc\r
\n-rw-r--r-- root root 12219 1970-01-01 08:00 factory_init.rc\r\n-rw-r--r-- root root 27406 1970-01-01 08:00 file_contexts\r\n-rw-r--r-- r
oot root 932 1970-01-01 08:00 fstab\r\n-rw-r----- root root 932 1970-01-01 08:00 fstab.fat.nand\r\n-rw-r----- root root 9
32 1970-01-01 08:00 fstab.nand\r\n-rwxr-x--- root root 257760 1970-01-01 08:00 init\r\n-rwxr-x--- root root 411 1970-01-01 08:00 init.aee
.customer.rc\r\n-rwxr-x--- root root 25820 1970-01-01 08:00 init.charging.rc\r\n-rwxr-x--- root root 1123 1970-01-01 08:00 init.environ.r
c\r\n-rwxr-x--- root root 3414 1970-01-01 08:00 init.modem.rc\r\n-rwxr-x--- root root 829 1970-01-01 08:00 init.no_ssd.rc\r\n-rwxr-x---
root root 4841 1970-01-01 08:00 init.project.rc\r\n-rwxr-x--- root root 969 1970-01-01 08:00 init.protect.rc\r\n-rwxr-x--- root ro
ot 51072 1970-01-01 08:00 init.rc\r\n-rwxr-x--- root root 2126 1970-01-01 08:00 init.trace.rc\r\n-rwxr-x--- root root 21254 1970-0
1-01 08:00 init.usb.rc\r\n-rwxr-x--- root root 583 1970-01-01 08:00 init.xlog.rc\r\n-rwxr-x--- root root 25824 1970-01-01 08:00 init2.ch
arging.rc\r\n-rwxr-x--- root root 51076 1970-01-01 08:00 init2.rc\r\n-rw-r--r-- root root 10879 1970-01-01 08:00 meta2_init.rc\r\n-rw-r--r
-- root root 974 1970-01-01 08:00 meta_init.modem.rc\r\n-rw-r--r-- root root 2447 1970-01-01 08:00 meta_init.project.rc\r\n-rw-r--r-- r
oot root 10875 1970-01-01 08:00 meta_init.rc\r\ndrwxrwxr-x root system 2014-05-13 10:11 mnt\r\ndr-xr-xr-x root root 1
970-01-01 08:00 proc\r\n-rw-r--r-- root root 2197 1970-01-01 08:00 property_contexts\r\ndrwxrwx--x system system 2010-01-01 08:02 prote
ct_f\r\ndrwxrwx--x system system 2010-01-01 08:02 protect_s\r\ndrwx------ root root 2014-03-07 22:10 root\r\ndrwxr-x--- nvram s
ystem 1970-01-01 08:00 sbchk\r\ndrwxr-x--- root root 1970-01-01 08:00 sbin\r\nlrwxrwxrwx root root 2014-05-13 10:11
sdcard -> /storage/sdcard0\r\n-rw-r--r-- root root 663 1970-01-01 08:00 seapp_contexts\r\n-rw-r--r-- root root 235697 1970-01-01 08:00 s
epolicy\r\ndrwxr-x--x root sdcard_r 2014-05-13 10:11 storage\r\ndr-xr-xr-x root root 2014-05-13 10:11 sys\r\ndrwxr-xr-x root r
oot 2014-04-09 13:47 system\r\n-rw-r--r-- root root 6903 1970-01-01 08:00 ueventd.rc\r\nlrwxrwxrwx root root 2014-05-1
3 10:11 vendor -> /system/vendor\r\n'
>>> device.shell("ls -l")