Appending command output to a timestamped logfile (Linux vs Windows)

In Linux, it’s easy to log the output of a command to a timestamped log file:

echo this is easy >> $(date +%s).log

When I tried to accomplish the same thing in Windows, I ended up with this mess:

for /f "tokens=1,2,3,4 delims=/- " %%a in ("%date%") do set ts=%%d%%b%%c
echo this sucks >> %ts%.log

1 Responses to “Appending command output to a timestamped logfile (Linux vs Windows)”


  • yeah, the keyboard and command line is much more efficient that pissing about looking through menus / toolbars with a mouse. But people suck.. I type this on a windows box too, but I get paid to code in .net so I almost have an excuse.

Leave a Reply