Skip to main content

Posts

Showing posts from June, 2008

Creating a file with current date in a Batch process

With the plethora of sites out there with information on creating Batch processes, it's easy to get overwhelmed and confused over the series of DOS commands. I have a Batch process which restarts a hungry service daily, only to ensure that it cleans up the memory (which it doesn't do so well). The next requirements is for the Batch process to backup the service's log file... with the date. The command that does this for me is: %date:~-4,4%-%date:~-7,2%-%date:~0,2% log.txt This creates the filename in the following format: 2008-06-02 log.txt If you are including this in long path names delimited with quotations ("), it will still work. Just include the command as if it's part of the filename.