set currentYear=2013
set logDate=0
set tempLogDate=0
set fileName2=0
setlocal enabledelayedexpansion
for /f "delims=" %%a in ('dir /a-d/b/s "%logDirectory2%"^|findstr /riv "^.*\\[^\\]*%now%[^\\]*$"') do (
set fileName2=%%a
call set fileName2=!fileName2!:!currentYear!=%%
set tempLogDate=%currentYear%!fileName2:~0,4!
if !tempLogDate! GTR %logDate% ( set logDate=%tempLogDate% )
)
echo !logDate!
问题是变量内部循环没有得到改变,提前谢谢
*我改变了一些代码,但仍然没有解决...... :(多么糟糕的一周开始
答案 0 :(得分:1)
为了在变量循环中更改变量的变量,你需要调用enabledelayedexpansion
(你有)然后你需要使用!varname!访问changing
值; `%varname%访问PARSE-TIME值,即,初始变量值 BEFORE 循环 STARTED