- @echo
- setlocal enabledelayedexpansion
- set /a day=%date:~5,2%%date:~8,2%
- set /a month=%date:~5,2%%%100
- set days=0101,0201,0301,0401,0501,0601,0701,0801,0901,1001,1101,1201
- set yesterdays=1231,0131,0228,0331,0430,0531,0630,0731,0831,0930,1031,1130
- for /f "tokens=%month% delims=," %%i in ("%days%") do (
- if %day%==%%i (for /f "tokens=%month% delims=," %%a in ("%yesterdays%") do (set /a date=%date:~0,4%%%a)) else (set /a date=%date:~0,4%%date:~5,2%%date:~8,2% ))
- echo %date%
- pause
复制代码 下面for循环引用day不对了!!我找不出原因!!
[ 本帖最后由 hucuibai 于 2011-1-12 17:24 编辑 ] |