Solved Batch to display Happy Birthday

September 24, 2020 at 01:53:00
Specs: Windows 7
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?

See More: Batch to display Happy Birthday


#1
October 1, 2020 at 07:42:08
✔ Best Answer
Hi all

I have been given the answer from somewhere else, but in case anyone else needs it, below is the code:

@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


Reply ↓  Report •
Related Solutions


Ask Question