Windows backup date for the tape

We set up a scheduled task to back up our servers every week night.  When the back up runs, every tape gets the same date.  This date is the date the job was created.  Can I take the string in the run line ("Media created 3/2/2005 at 1:45 PM" /d "Set created 3/2/2005 at 1:47 PM") and change the dates to %date%?

Will this work or is there another way?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kevin HaysIT AnalystCommented:
Here is one of my bat files that I use to backup my data on the server.  Just copy, paste and modify this if you think this might be what you are looking for.  This was the only way I could pull it off because %date% didn't work inside of a filename.


@echo off
rem - ---------------------------------------------------------------------
rem - Backups the applications on the Active Directory Server
rem - Normal backup
rem - ---------------------------------------------------------------------
rem i = Day of week
rem j = Month number
rem l = Year number

for /f "tokens=1,2,3,4* delims=.:/- " %%i in ('date /t') do (
  for /f "skip=1 tokens=1-4 delims=/-,()." %%x in ('echo.^|date') do (
  set weekday=%%i&set month=%%j&set day=%%k&set year=%%l))

for /f "tokens=1,2* delims=: " %%i in ('time /t') do (
  set hh=%%i&set min=%%j)

REM Set the filename to the date/time
set filename=Apps(%weekday%%month%%day%%year%-%hh%-%min%m)

REM store the backup once it is completed on E:\Backups\*
REM Scheduled backup from scheduled tasks is saved in C:\BackupJobs\*
ntbackup backup "@C:\BackupJobs\BackupGroupFolders.bks" /f "e:\Backups\%filename%_NORMAL.bkf" /v:yes /m normal

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
andyowwAuthor Commented:
I found this:;en-us;239892&sd=tech

Which says:

This is a more complex example, however, it is a real-life example that performs the following procedures completely unattended: • Refreshes RSM database.
• Sleeps for 30 seconds to ensure that RSM is refreshed.
• Sets environment variables used to create unique tape names.
• Starts Ntbackup, which Mounts any existing tape in the tape drive by using the /um switch.
• Performs the backup and changes the tape name to the following format:
• Ejects the tape from the tape drive.
echo off
  rsm.exe refresh /LF"HP C1537A SCSI Sequential Device"
  sleep 30
  for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set dt=%%i-%%j-%%k-%%l
  for /f "Tokens=1" %%i in ('time /t') do set tm=-%%i
  set tm=%tm::=-%
  set dtt=%dt%%tm%
  c:\winnt\system32\ntbackup.exe backup "@C:\Documents and Settings\Administrator\Local Settings
\Application Data\Microsoft\Windows NT\NTBackup\data\Daily.bks"
  /n "%computername%-%dtt%" /d "daily %dtt%" /v:yes /r:no /rs:no /hc:on
  /m normal /j "daily %dtt%" /l:f /p "4mm DDS" /UM
  rsm.exe eject /PF"%computername%-%dtt% - 1" /astart
Do you have your batch file run as a scheduled task then?
Are you using e:\Backups\ as you backup directory instead of sending to tape?
andyowwAuthor Commented:
I got it to work using the batch file I found.

I'll give you the points because you pointed me in the right direction.

Kevin HaysIT AnalystCommented:
No problems, glad you got something that fits your needs, what it's all about :)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 2000

From novice to tech pro — start learning today.