Batch to display Happy Birthday
Moderator: DosItHelp
Batch to display Happy Birthday
I have a logon script that maps the user to drives after they logon. Is It possible to show a line within this to say Happy Birthday on the day it is their birthday? Subsequently I can then edit it for other days like Christmas, Easter or other days of interest?
Re: Batch to display Happy Birthday
No problem for holidays or anniversaries at a fixed date.
But for days like Easter? I never tried to write a transcription of Gauss' Easter algorithm in pure Batch, but you may give it a go ... The formula is large but probably simple enough to bring it into a subroutine.
Steffen
Code: Select all
@echo off &setlocal
for /f %%i in ('WMIC OS Get LocalDateTime /value') do for /f %%j in ("%%i") do set "%%j"
if "%LocalDateTime:~4,4%"=="0928" echo Happy Today!
if "%LocalDateTime:~4,4%"=="1225" echo Merry Christmas!
pause
Steffen
Re: Batch to display Happy Birthday
Hi Steffen
Many thanks for the quick reply.
This is exactly what I am after, thank you so much.
It is only going to be used to days that stay the same so no problem there.
Thanks again!
Many thanks for the quick reply.
This is exactly what I am after, thank you so much.
It is only going to be used to days that stay the same so no problem there.
Thanks again!
Re: Batch to display Happy Birthday
I didnt find an Easter algorithm here, so I decided to write one. Just in case you're interested ...
viewtopic.php?f=3&t=9792#p62989
Steffen
viewtopic.php?f=3&t=9792#p62989
Steffen