PDA

View Full Version : batch file help



roXet
June 17th, 2004, 09:45 AM
does anybody know how to append the date to the name of a file you create from within a batch file?

Example:
On my mail server they have a backup utility that dumps a backup file of the configuration. I want to make a batch file to do this for me so I can schedule it, and I need the file that is created to ahve the date in the filename. The syntax looks like this:

c:\backuptuil c:\backup\mailbackup.dat

but I can't figure out how to stick the date into the filename so that it looks something like "mailbackup06172004.msb"

anybody got any ideas?

roXet
June 17th, 2004, 09:56 AM
nevermind I figued something out. =)

LA_MERC_T4rg3T
June 17th, 2004, 10:08 AM
add an extra line at the bottom of your batch file

FOR /f "tokens=2-4 delims=/ " %%a in ('date /t') do move c:\mailbackup.msb c:\mailbackup%%a%%b%%c.msb

Might work, might not.. didn't test.. lol

roXet
June 17th, 2004, 10:31 AM
that worked! thanks toby!

42d3e78f26a4b20d412==