For a batch file, under win9x...
I got this from the site listed in the comments.
I wrote my own variations for different purposes.
start file---------------------
:: D&T.BAT - Saves Date and/or Time into a named environment variable.
:: Tom Lavedas <lavedas@pressroom.com>
::
@echo %dbgt% off
%3 echo %0 %%3 %%4 :: %1 %2> {a}.bat
%3 dir {a}.bat | find "{A} " > {t}.bat
%3 {t}
del {?}.bat
if [%4]==[] echo Date: %1 Time: %2
if not [%4]==[] set %4=%1
if not [%5]==[] set %5=%2
end file------------------------------
I called that one "getdate.bat" and called it with the following:
start file----------------------------
getdate datename
rename fubar.mdb %datename%_fubar.mdb
end file------------------------------
good luck.