@REM E M B E R Y e s t e r d a y @REM 2008, Chaoji Li @echo off REM You may need to adjust the following three fields according REM to the date format in your system. set _y=%DATE:~6,4% set _m=%DATE:~0,2% set _d=%DATE:~3,2% set _date=%_y%%_m%%_d% set /a y= %_date% - 1 set _d=%y:~6,2% set /a _leap=%y%-%y%/4*4 set _feb=0229 if not %_leap%==0 set _feb=0228 if not %_d%==00 goto DONE if %_m%==12 set y=%_y%1130& goto DONE if %_m%==11 set y=%_y%1031& goto DONE if %_m%==10 set y=%_y%0930& goto DONE if %_m%==09 set y=%_y%0831& goto DONE if %_m%==08 set y=%_y%0731& goto DONE if %_m%==07 set y=%_y%0630& goto DONE if %_m%==06 set y=%_y%0531& goto DONE if %_m%==05 set y=%_y%0430& goto DONE if %_m%==04 set y=%_y%0331& goto DONE if %_m%==03 set y=%_y%%_feb%& goto DONE if %_m%==02 set y=%_y%0131& goto DONE if %_m%==01 set /a y=%_y% - 1 & set y=%y%1231& goto DONE :DONE set YESTERDAY=%y% echo %YESTERDAY%