Append date to log file names

Here's a simple script for a batch file to append the current date to log files.

As an administrator for a Windows network, scripting to automate tasks becomes more of a necessity. Here is a simple...

script for a batch file to append the current date to log files:

For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set date=%%a-%%b-%%c)
REM This sets a variable %date% to the current date.
REM Just append %date% to the log (output) file name.
REM Use >logfile%date%.log to create a new log file or >>logfile%date%.log to append to the log file.


This was first published in November 2001

Dig Deeper

PRO+

Content

Find more PRO+ content and other member only offers, here.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchServerVirtualization

SearchCloudComputing

SearchExchange

SearchSQLServer

SearchWinIT

SearchEnterpriseDesktop

SearchVirtualDesktop

Close