批处理bat 之 导出Android车机和T-Box的日志

背景:

T-Box与Android车机相连接,Android车机与PC相连接,Android车机系统可以通过adb shell命令访问T-Box系统。

实现功能:

 将T-Box log和Android车机log,导出到PC电脑中。

 

代码:

@echo off

if "%time:~0,1%"==" " set "time=0%time:~1%"
set date_folder=%date:~0,4%-%date:~5,2%-%date:~8,2%
set time_folder=%time:~0,2%-%time:~3,2%-%time:~6,2%
set log_folder="%date_folder%-%time_folder%"

if NOT EXIST %date_folder% md %date_folder%
cd %date_folder%
md %log_folder%

:main
echo %log_folder%
echo Please choose execution:
echo     1.hu_log
echo     2.tbox_log
echo     0.exit:

set /p choose=Please input choose: 
if %choose%==1 goto hu_log
if %choose%==2 goto tbox_log
if %choose%==0 exit
pause

:hu_log
echo Start exporting HU log ...
::pull HU log to PC
adb pull /data/logcat ./%log_folder%
echo Export HU log completion.
pause
goto main

:tbox_log
echo Start exporting tbox log ...
::delete old folder tbox_log
adb shell rm -rf /sdcard/tbox_log
::create a new folder tbox_log
adb shell mkdir -p /sdcard/tbox_log
echo Step1:pull tbox log to HU
adb shell adb pull /mnt/log/. /sdcard/tbox_log
echo Step2:pull tbox log to PC
adb pull /sdcard/tbox_log ./%log_folder%
::delete sdcard tbox log
adb shell rm -rf /sdcard/tbox_log
echo Export tbox log completion.
pause
goto main

 

posted @ 2021-01-02 12:53  张小力  阅读(1033)  评论(0编辑  收藏  举报