- 帖子
- 976
- 积分
- 1708
- 技术
- 241
- 捐助
- 0
- 注册时间
- 2014-6-17
|
又踩了两个雷,for /r 的路径不能用上个循环的变量,括号里的括号要转义
@echo off&setlocal enabledelayedexpansion
set/p XXX=input
set/p t=min
set tn=!time: =0!
set/a tn=10000!tn:~0,2!*60+10000!tn:~3,2!
set/a t=!tn!-!t!
set "p1=\\btssvr9\pds1\!XXX!\3d\eqp_dgn"
set "p2=\\btssvr9\pds1\!XXX!\3d\eqp_dgn"
set "d=!USERPROFILE!\Desktop\SPR\!XXX!\"
echo !date!|findstr /i "[a-z]">nul && set dt=!date:~4,10! || set dt=!date:~0,10!
for %%a in ("%p1%" "%p2%") do (
pushd "%%a"
for /r %%b in (*.*) do (
echo %%~tb | find "PM">nul && (set tf=%%~tb & set/a tf=^(10000!tf:~11,2!+12^)*60+10000!tf:~14,2!) || (set tf=%%~tb & set/a tf=10000!tf:~11,2!*60+10000!tf:~14,2!)
set df=%%~tb
if "!dt!" == "!df:~0,10!" if "!tf!" gtr "!t!" echo copy "%%b" "!d!" /y
)
popd
) |
|