批处理怎么根据文件修改时间决定是否替换
1个回答
展开全部
@echo off & setlocal enabledelayedexpansion
set "fileA=a.txt"
set "fileB=b.txt"
for %%i in ("%fileA%" "%fileB%") do (
set /a num+=1
set "data!num!=%%~ti"
)
if "%data1%" gtr "%data2%" (copy /y "!fileA!" "!fileB!") else (echo 不替换)
pause
set "fileA=a.txt"
set "fileB=b.txt"
for %%i in ("%fileA%" "%fileB%") do (
set /a num+=1
set "data!num!=%%~ti"
)
if "%data1%" gtr "%data2%" (copy /y "!fileA!" "!fileB!") else (echo 不替换)
pause
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询