杀掉Monkey进程

一、Kill  Monkey进程 (Windows CMD)

for /f "tokens=2" %a in ('adb shell ps ^|findstr "monkey" ') do adb shell kill %a 

二、Kill  Monkey进程(Pyhont)

import StringIO
import subprocess


def main():
    output = subprocess.check_output("adb shell ps")
    buf = StringIO.StringIO(output)
    for line in buf:
        if "com.android.commands.monkey" in line:
            fragments = line.split()
            pid = fragments[1]
            subprocess.call("adb shell kill -9 " + pid)
            return
        
if __name__ == '__main__':
    main()


三、Kill 5037 (Windows CMD)

@echo off
for /f "tokens=5 delims= " %%i in ('netstat -aon ^|findstr "5037"') do (
   for /f  "tokens=1 delims= " %%a in ('tasklist ^| findstr "%%i"') do (
      taskkill /f /im %%a 2>nul
)
)
pause



你可能感兴趣的:(杀掉Monkey进程)