我一直在处理批处理脚本以检查提交的内容。我昨天早上工作了,但由于某种原因,我设置的变量开始变得不起作用。这是代码:
for /f %%a in ('dir /B/A:D') do (
for /f "tokens=1-3 delims=/ " %%b in ("%%~ta") do (
set FCMONTH=%%b
set FCDAY=%%c
set FCYEAR=%%d
echo %FCMONTH%\%FCDAY%\%FCYEAR%
)
)
行由行:
答案 0 :(得分:2)
setlocal enableDelayedExpansion
for /f %%a in ('dir /B/A:D') do (
for /f "tokens=1-3 delims=/ " %%b in ("%%~ta") do (
set FCMONTH=%%b
set FCDAY=%%c
set FCYEAR=%%d
echo !FCMONTH!\!FCDAY!\!FCYEAR!
)
)