Problem solve Get help with specific problems with your technologies, process and projects.

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 last published in November 2001

Dig Deeper on Microsoft Windows Systems and Network Management

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.