I am writing a program to backup all the files in zip format from a drive. I am using PKzip software that runs...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
in command line. Since this program needs to run everyday, the zip files name will be in accordance with the date. Suppose the file is stored today the zip file name will be 05/08/02, etc. Since I can't have variables defined in batch file, I used Windows scripting host, i.e. VBS to give me current date. Now I have current date in VBS format and command for zip file in batch format. I need to combine all this in WSH so that scheduler will start this program every morning. How do I do that?
This is really a Windows question and I am far from a Windows GURU but I'll give it a shot.
My quick advice: Forget VBS and the scripting host and use batch files. You can indeed have variables in a batch file. Here is the script I use (and run using the "Scheduled Activities" GUI in 2000/XP) to back up my registry to a new file every day. (Actually, it backs it up to alternating names. One day is uses .1, the next is uses .2 and so on). You should be able to modify this script to do what you want. The last two lines are used to zip up the backup of the registry file.
if %DAY%==Sun set BIT=1
if %DAY%==Mon set BIT=2
if %DAY%==Tue set BIT=1
if %DAY%==Wed set BIT=2
if %DAY%==Thu set BIT=1
if %DAY%==Fri set BIT=2
if %DAY%==Sat set BIT=1
ntbackup backup systemstate /J "Backup Job %BIT%" /F "C:REG-%BIT%.bkf"
if exist C:REG-%BIT%.ZIP DEL C:REG-%BIT%.ZIP
C:Progra~1OntrackZipMagiczmzip -e4 -m C:REG-%BIT%.ZIP C:REG-%BIT%.bkf
Editor's note: Do you agree with this expert's response? If you have more to share, post it in one of our .bphAaR2qhqA^0@/searchstorage>discussion forums.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.