Hi,

> On Jan 30, 2024, at 7:00 AM, Jürgen Wondzinski via Freedos-user 
> <freedos-user@lists.sourceforge.net> wrote:
> 
> Hi all,
> 
> I'm currently facing some users which seem to have a bad BIOS battery and 
> therefor aren't using the current date. 
> Those users aren't even noticing that wrong date on their printed invoices of 
> that day...  
> 
> Is there a simple way to check from Autoexec/FDAUTO for the year of the date, 
> and if lower than 2024 prompt for a correct setting?
> 
> Thanks!

Sure. 

You can have date output the current date and save it in an environment 
variable. 
The test the return string against the known BAD value.

Something like…

set /e TODAY=date /d
if “%TODAY%” == “Current date is TUE 01-30-2024” goto BadDate
goto GoodDate
:BadDate
date
time
:GoodDate
set TODAY=


Or, if you want to get a little more fancy…

date /d | vstr /b /f “ “ 5- | set /p TODAY=
if “%TODAY%” == “01-30-2024” goto BadDate
(see above)

Or, even just check the year…

date /d | vstr /b /f - 3 | set /p YEAR=
if “%YEAR%” == “2024” goto BadDate
(see above)

Or, even better…

date /d | vstr /b /f - 3 | set /p YEAR=
if NOT “%YEAR%” == “1980” goto GoodDate
date
time
:GoodDate
set YEAR=


Jerome

> 
> 
> 
> 
> _______________________________________________
> Freedos-user mailing list
> Freedos-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freedos-user

_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to