setlocal enabledelayedexpansion
:: *** Get the current date into the variables dd, mm, yy:
for /f "tokens=1-3 delims=." %%a in ("%date%") do (
set dd=%%a
set mm=%%b
set yy=%%c
)
:: *** Leap check:
set Feb=28
set /a Leap=yy %% 4
echo %Leap%
if "%Leap%"=="0" set Feb=29
:: *** The date comes with leading zeroes; add 100 to the counter so we don't have to strip them off:
set i=101
for %%a in (31 %Feb% 31 30 31 30 31 31 30 31 30 31) do (
if !i!==1%mm% set LastDay=%%a
set /a i+=1
)
echo This month's last Day: [%LastDay%]
if %dd%==%LastDay% echo Today is the last day of this month.
REM if %dd%==%LastDay% call fri.bat
ENDLOCAL
:: *** Get the current date into the variables dd, mm, yy:
for /f "tokens=1-3 delims=." %%a in ("%date%") do (
set dd=%%a
set mm=%%b
set yy=%%c
)
:: *** Leap check:
set Feb=28
set /a Leap=yy %% 4
echo %Leap%
if "%Leap%"=="0" set Feb=29
:: *** The date comes with leading zeroes; add 100 to the counter so we don't have to strip them off:
set i=101
for %%a in (31 %Feb% 31 30 31 30 31 31 30 31 30 31) do (
if !i!==1%mm% set LastDay=%%a
set /a i+=1
)
echo This month's last Day: [%LastDay%]
if %dd%==%LastDay% echo Today is the last day of this month.
REM if %dd%==%LastDay% call fri.bat
ENDLOCAL
Комментариев нет:
Отправить комментарий