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.


Dig Deeper on Windows systems and network management

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchServerVirtualization

SearchCloudComputing

SearchSQLServer

SearchEnterpriseDesktop

SearchVirtualDesktop

Close