Often want to create a log file from a cmd batch script which is unique for each day
for /F "tokens=1-6 delims=/ " %%A in ('date /t') do ( set dt=%%D_%%C_%%B_) for /F "tokens=1-6 delims=: " %%A in ('time /t') do ( set tt=%%A_%%B_%%C) set logfile="x:\LogFiles\%dt%_%tt%_nanotera.log" echo %logfile% @date /t >> %logfile% @time /t >> %logfile% @echo %0 >> %logfile% @echo Backup Data folder. >> %logfile% @echo ------------------- >> %logfile%