供参考
echo.&echo ===== %folder% 恢复 Printers.请等待 =====
set time_begin=%time:~0,-3%
start /wait /min cmd.exe /c C:\Windows\System32\spool\tools\Printbrm.exe -R -F %folder%
set time_end=%time:~0,-3%
call :_difftime %time_begin% %time_end%
echo Printers 恢复完成. 用时: %hour_% 时 %munite_% 分 %second_% 秒
pause >nul
goto :BackupTools
:_difftime <time_begin> <time_end>
for /f "tokens=1,2,3 delims=:" %%i in ("%time_begin%") do (
set /a hour_b=%%i
set /a munite_b=%%j
set /a second_b=%%k
)
for /f "tokens=1,2,3 delims=:" %%i in ("%time_end%") do (
set /a hour_a=%%i
set /a munite_a=%%j
set /a second_a=%%k
)
if %second_a% lss %second_b% (
set /a munite_a=%munite_a%-1
set /a second_a=%second_a%+60
)
set /a second_=%second_a%-%second_b%
if %munite_a% lss %munite_b% (
set /a hour_a=%hour_a%-1
set /a munite_a=%munite_a%+60
)
set /a munite_=%munite_a%-%munite_b%
if %hour_a% lss %hour_b% (
set /a hour_a=%hour_a%+24
)
set /a hour_=%hour_a%-%hour_b%
Goto :eof |