| @echo off | | :rec | | adb devices | findstr /rec:"device" 1>nul || (echo not connect & timeout 1 & goto :rec) | | for /f "tokens=2" %%a in ('tasklist ^| find "adb.exe"') do ( | | set _pid=%%a | | ) | | | | :loop | | for /f "delims=" %%a in ('wmic os get localdatetime ^| findstr [0-9]') do ( | | set t=%%a | | ) | | start /b cmd "/c adb logcat > D:\log_%t:~0,14%.txt" | | timeout 3 | | for /f "tokens=2" %%a in ('tasklist ^| find "adb.exe" ^| find /v " %_pid% "') do ( | | taskkill /f /pid %%a | | ) | | goto :loopCOPY |
|