Advertisment

Batch Scripts for Backup 

author-image
PCQ Bureau
New Update

Rather than investing a huge amount of money on backup solutions, you can customize batch scripts to take periodic data backup. Let us see how.

Advertisment

Suppose, you have a file server (PDC) running an NT server with clients connected to it. Now, to take back up of a client’s local data, you will have to create a batch script, which will map a shared folder on an NT server. You then need to copy the client’s data to that shared folder (backup). From this folder, the administrator can further preserve the data on a tape or any other backup media if required. 

Adding backup script to the scheduled task

The batch file created, will take a backup of your Document Setting folder, which contains all the important settings and data of your Windows machine. This is how you write the batch file:

Advertisment

Backup Batch file echo off



Echo “Backing up of your data......”


net use g: \\NTfileserver\backup (mapping the network drive as g)


xcopy “c:\Documents and Settings\*.*” g:\backup /S/E /y (copping files to network drive)


net use g: /DELETE (Disconnecting the network drive)


Echo “Backup compleated....”


echo on




After creating the file, you can include it in the Windows scheduler so that automated data backup can be done. For this, open Scheduled Task from Start>Programs>Accessories>system tools >Scheduled Task. Now double click on Add Scheduled Task. This will run a wizard to create the Scheduled Task. Click next, here you will be asked to give the path of a schedule application. Give the full path of your backup batch file and again click next. Now, here you need to give when this batch file will be executed (daily, weekly, monthly etc) and you can even set the time of execution. Select any one according to your convenience and click on Next. Now give the user name and password of the client’s machine.

With this, your Scheduler Task is ready to use and the client data will be backed up on a server automatically. Then, administrator can take a final back up on any backup medium. 

This is a simple backup script to take backup on a network. You can add other DOS commands if required. 

Sanjay Majumder

Advertisment