Every now and then is necessary to log some command line output. If you need to recursively do it every in a automatic way it's good that you timestamp the log file with the current date.
So to do it use a batch file with the following instructions
set startDate=%date%
set startTime=%time%
set sdy=%startDate:~10%
set /a sdm=1%startDate:~4,2% - 100
set /a sdd=1%startDate:~7,2% - 100
set /a sth=%startTime:~0,2%
set /a stm=1%startTime:~3,2% - 100
set /a sts=1%startTime:~6,2% - 100
somecommand > logfilename%sdy%%sdm%%sdd%%sth%%stm%.txt
No comments:
Post a Comment