- 帖子
- 135
- 积分
- 178
- 技术
- 1
- 捐助
- 0
- 注册时间
- 2021-5-27
|
回复 jave000
虽然有5列多了一列,时间的位置一样的没有输出内容奇怪,确定这里面有今天的新文件吗 ...
idwma 发表于 2021-7-14 18:13
在家用自己电脑测试了下,以下是运行状态:
中文都改成几个大写字母了
C:\Users\Siren>D:\2.BAT
C:\Users\Siren>setlocal enabledelayedexpansion
C:\Users\Siren>set/p XXX=input
input123
C:\Users\Siren>set/p t=min
min22
C:\Users\Siren>for /F "tokens=1,2 delims=: " %i in ('time/t') do set/a tn=10000%i*60+10000%j
C:\Users\Siren>set/a tn=1000022*60+1000013
C:\Users\Siren>set/a tn=!tn!-!t!
C:\Users\Siren>set "p1=D:\Downloads\!XXX!\789"
C:\Users\Siren>set "p2=D:\Downloads\!XXX!\456"
C:\Users\Siren>set "d=!USERPROFILE!\Desktop\!XXX!"
C:\Users\Siren>for %a in (D:\Downloads\123\789 D:\Downloads\123\456) do (for /F "tokens=2,5* delims= " %i in ('dir/a-d "%a" |find "!date:~0,10!"') do (
if "%i" == "" (echo !date!NO ) else (echo ONE%j )
set tf=%i
set/a tf=10000!tf:~0,2!*60+10000!tf:~3,2!
if "!tf!" GTR "!tn!" (echo copy "%a\%j" "!d!" /y ) else (echo NOT )
) )
C:\Users\Siren>(for /F "tokens=2,5* delims= " %i in ('dir/a-d "D:\Downloads\123\789" |find "!date:~0,10!"') do (
if "%i" == "" (echo !date!NO ) else (echo ONE%j )
set tf=%i
set/a tf=10000!tf:~0,2!*60+10000!tf:~3,2!
if "!tf!" GTR "!tn!" (echo copy "D:\Downloads\123\789\%j" "!d!" /y ) else (echo NOT )
) )
C:\Users\Siren>(
if "22:10" == "" (echo !date!NO ) else (echo ONE )
set tf=22:10
set/a tf=10000!tf:~0,2!*60+10000!tf:~3,2!
if "!tf!" GTR "!tn!" (echo copy "D:\Downloads\123\789\" "!d!" /y ) else (echo NOT )
)
ONE
copy "D:\Downloads\123\789\" "C:\Users\Siren\Desktop\123" /y
C:\Users\Siren>(for /F "tokens=2,5* delims= " %i in ('dir/a-d "D:\Downloads\123\456" |find "!date:~0,10!"') do (
if "%i" == "" (echo !date!NO ) else (echo ONE%j )
set tf=%i
set/a tf=10000!tf:~0,2!*60+10000!tf:~3,2!
if "!tf!" GTR "!tn!" (echo copy "D:\Downloads\123\456\%j" "!d!" /y ) else (echo NOT )
) )
C:\Users\Siren>(
if "22:05" == "" (echo !date!NO ) else (echo ONE- )
set tf=22:05
set/a tf=10000!tf:~0,2!*60+10000!tf:~3,2!
if "!tf!" GTR "!tn!" (echo copy "D:\Downloads\123\456\-" "!d!" /y ) else (echo NOT )
)
ONE-
copy "D:\Downloads\123\456\-" "C:\Users\Siren\Desktop\123" /y
C:\Users\Siren>(
if "22:05" == "" (echo !date!NO ) else (echo ONE- )
set tf=22:05
set/a tf=10000!tf:~0,2!*60+10000!tf:~3,2!
if "!tf!" GTR "!tn!" (echo copy "D:\Downloads\123\456\-" "!d!" /y ) else (echo NOT )
)
ONE-
copy "D:\Downloads\123\456\-" "C:\Users\Siren\Desktop\123" /y |
|