获取测试log并压缩批处理

@echo off
color 2f
rem ********************************************************************************
rem *****First Release For get log By soulor 2011-06-04*****************************
rem ********************************************************************************
echo ***********log存放路径为当前目录\log\当前日期\当前时间_log.rar*****************
echo.

echo ***********log路径事例子 log\2011-06-04\11点20分_log.rar***********************
echo *******************************************************************************
echo ***请确保电脑已安装WINRAR解压缩软件,且路径为"C:\Program Files\WinRAR"*********
echo *******************************************************************************
echo.
rem ************************************************
rem echo ****请确认USB已经连接到手机且调试口打开*********
rem echo ************************************************
rem echo ********按任意键开始获取log*********************

set rar_path="C:\Program Files\WinRAR"
set path1=.

echo.

if exist %path1%\log goto getdate
md %path1%\log

:getdate

date /t>date.txt
for /f "eol=; tokens=1 delims= " %%i in (date.txt) do set current_date=%%i
if exist %path1%\log\%current_date% goto create

md %path1%\log\%current_date%

:create
time /t>time.txt
for /f "eol=;tokens=1,2 delims=:" %%i in (time.txt) do set current_time=%%i点%%j分

md %path1%\log\%current_date%\%current_time%

set log_path=%path1%\log\%current_date%\%current_time%

adb pull data/dumplog %log_path%\dumplog

echo ****************************************
echo ******请等耐心等待,正在获取trace.txt***
echo ****************************************
echo.
adb logcat > %log_path%\logcat
adb pull data/anr/trace.txt %log_path%\trace.txt
echo ****************************************
echo ******请等耐心等待,正在获取bugreport***
echo ****************************************
adb bugreport>%log_path%\bugreport.txt

:pass
del date.txt
del time.txt


cd %path1%\log\%current_date%
copy %rar_path%\rar.exe
rar a %current_date%_%current_time%_log.rar %current_time%
md log
%current_date%_%current_time%_log.rar e log
del rar.exe

rd /s /q %current_time%

set log_path=
set current_date=
set current_time=

echo **************************************************************
echo *******************获取log并压缩成功**************************
echo **************************************************************