I'd like to have log with prepend of time and username, but I haven't been able to get %TIME% and %DATE% to dynamically be evaluated. I've tried many versions of using "!", but I've never gotten it to work. What I'd like is to have
Setlocal EnableDelayedExpansion
set nameDateTime=!%USERNAME% %DATE% %TIME%!
echo %nameDateTime%
echo %nameDateTime%
echo %nameDateTime%
EndLocal
to produce 3 different times (assuming they're done far enough apart). I tried the second answer in: How to create a user Environment variable that *calls* %date% or %time% each time it's invoked?, but when I call echo %date1%, it just prints out date1, while set date1 prints out the whole !date1..! line.