@echo off REM Get useful date out of Windows Native REM v1.0 Sometime in 2001 or 2002 REM Set a local scope for the following variables setlocal for /F "tokens=1-4 delims=/ " %%i in ('date /t') do ( set DayOfWeek=%%i set Month=%%j set Day=%%k set Year=%%l ) for /F "tokens=1-3 delims=:" %%i in ('time /t') do ( set Hour=%%i set Minute=%%j ) echo. echo. echo Date: %Year%-%Month%-%Day%-%Hour%:%Minute% echo Date: %Year%-%Month%-%Day% %Hour%:%Minute% echo. echo You could now do something like this, which will work: echo copy mylog %%Year%%-%%Month%%-%%Day%%-mylog echo copy mylog %Year%-%Month%-%Day%-mylog echo. echo The problem is that if you try to use the time, like this: echo copy mylog %%Year%%-%%Month%%-%%Day%%-%%Hour%%:%%Minute%% echo. echo You might get something like this--probably not what you had in mind: echo copy mylog 2002-11-27- 1:36a-mylog echo. REM End the local scope for variables endlocal