日期:2014-05-17 浏览次数:20856 次
@echo off
::赋值A文件夹路径
set Apath=C:\A
::赋值B文件夹路径
set Bpath=C:\B
::赋值返回结果文件路径
set rFile=.\result.txt
if exist %rFile% (del %rFile%)
echo B=WScript.Arguments(0)>tmp.vbs
echo A=WScript.Arguments(1)>>tmp.vbs
echo A=Left(A,4)^&"-"^&Mid(A,5,2)^&"-"^&Mid(A,7,2)^&" "^&Mid(A,9,2)^&":"^&Mid(A,11,2)^&":"^&Right(A,2)>>tmp.vbs
echo B=Left(B,4)^&"-"^&Mid(B,5,2)^&"-"^&Mid(B,7,2)^&" "^&Mid(B,9,2)^&":"^&Mid(B,11,2)^&":"^&Right(B,2)>>tmp.vbs
echo Wscript.Echo DateDiff("s", B, A)>>tmp.vbs
for /f "tokens=1,2 delims=-" %%a in ('dir /b/a-d %Apath%') do (
for /f "tokens=1 delims=-" %%i in ('dir /b/a-d %Bpath%\*-*-*-%%b.Tdat') do (
if "%%i" neq "" (
for /f %%s in ('cscript /nologo tmp.vbs %%i %%a') do (echo %%a %%i 差值:%%s 秒>>%rFile%)
)
)
)
del /f /q tmp.vbs
pause