Ask the Expert

Backing up with Windows

I am writing a program to backup all the files in zip format from a drive. I am using PKzip software that runs 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?

Requires Free Membership to View

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.

set DAY=%DATE:~0,3%

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.


This was first published in May 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: