Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Disk back-up using task scheduler?

3 views
Skip to first unread message

Paul Westwell

unread,
Jan 23, 2005, 7:31:55 AM1/23/05
to
Hi,

I have a machine running XP home with three disk drives. I would like to be
able to schedule XP to backup one disk to the other on a weekly basis, this
would simply be a disk copy and overwrite existing contents (or just replace
those that have changed).

If this possible to do this using the task scheduler?

Regards,

Paul


Pegasus (MVP)

unread,
Jan 23, 2005, 8:36:11 AM1/23/05
to

"Paul Westwell" <paul...@nospam.westwell.me.uk> wrote in message
news:%OMId.1205$w65...@newsfe5-win.ntli.net...

It depends.

If you wish to back up your data files then xcopy.exe, embedded in
a batch file, would be your best choice.

If you wish to back up your WinXP system files then you would
need to use a tool such as ntbackup.exe, which is considerably
harder to use.


Paul Westwell

unread,
Jan 23, 2005, 9:21:12 AM1/23/05
to
Pegasus,

The data on the disk is Home Media, photographs, mp3 files, video etc, no
programs or system file.

Any help in pointing me towards a batch file that could use xcopy.exe and
could be run from XP task scheduler?

Regards,

Paul


"Pegasus (MVP)" <I....@fly.com> wrote in message
news:uxDjCCVA...@TK2MSFTNGP09.phx.gbl...

Ken Blake

unread,
Jan 23, 2005, 4:04:05 PM1/23/05
to
In news:%OMId.1205$w65...@newsfe5-win.ntli.net,
Paul Westwell <paul...@nospam.westwell.me.uk> typed:

Paul, if I were you, I would rethink this backup strategy.

I don't recommend backup to a second non-removable hard drive
because it leaves you susceptible to simultaneous loss of the
original and backup to many of the most common dangers: severe
power glitches, nearby lightning strikes, virus attacks, even
theft of the computer.

In my view, secure backup needs to be on removable media, and not
kept in the computer. For really secure backup (needed, for
example, if the life of your business depends on your data) you
should have multiple generations of backup, and at least one of
those generations should be stored off-site.

My computer isn't used for business, but my personal backup
scheme uses two identical removable hard drives, which fit into a
sleeve installed in the computer. I alternate between the two,
and use Drive Image to make a complete copy of the primary drive.


--
Ken Blake - Microsoft MVP Windows: Shell/User
Please reply to the newsgroup


Pegasus (MVP)

unread,
Jan 23, 2005, 7:36:55 PM1/23/05
to
Here is a simple example for c:\tools\MyBackup.bat. Use
the Task Scheduler to invoke once every day.

@echo off
set source=c:\MyHomeMedia
set target=d:\Backups\MyHomeMedia
set report=c:\Logs\backup.log
set error=c:\Logs\backup.err
if not exist c:\logs md c:\Logs

echo Backup performed on %date% at %time% > "%report%"
echo Backup performed on %date% at %time% > "%error%"
xcopy /s /y "%Source%" "%Target%\" 1>"%report%" 2>"%error%"

The batch file generates two log files in the folder c:\Logs. Use
notepad.exe to examine them!

As Ken rightly points out, backing up to a local disk only is
risky. I often use one local disk plus one out of two or more
removable media.


"Paul Westwell" <paul...@nospam.westwell.me.uk> wrote in message

news:spOId.63$od7...@newsfe1-gui.ntli.net...

Paul Westwell

unread,
Jan 24, 2005, 7:14:54 PM1/24/05
to
Thanks guys, I appreciate the comments on removable media etc and will look
into a better solution.

The script looks great, I had put together a very basic xcopy batch file
myself but the additional logging is nice to have and I could not figure
that out!

Regards,

Paul

"Pegasus (MVP)" <I....@fly.com> wrote in message

news:%23d74Pza...@TK2MSFTNGP11.phx.gbl...

Paul Westwell

unread,
Jan 25, 2005, 4:29:03 PM1/25/05
to
Pegasus,

In your script below have you got the switches in the right location?

On the MS website the syntax is...

Syntax
xcopy Source [Destination] [/w] [/p] [/c] [/v] [/q] [/f] [/l] [/g]
[/d[:mm-dd-yyyy]] [/u] [/i] [/s [/e]] [/t] [/k] [/r] [/h] [{/a|/m}] [/n]
[/o] [/x] [/exclude:file1[+[file2]][+[file3]] [{/y|/-y}] [/z]

Below you have xcopy followed immediately by the switches.

As I don't fully understand the full script I am not sure if this is correct
or not so you help would be greatly appreciated.

BTW I am using an existing xcopy in the following format....

XCOPY E:\*.* F:\ /C/V/F/I/D/S/K/H/O/Y

Any chance I could be cheeky and ask you to adjust to take into account my
paths and switches, I do like your logging & error idea!

Regards,

Paul

"Paul Westwell" <paul...@nospam.westwell.me.uk> wrote in message

news:2cgJd.687$Ht4...@newsfe2-gui.ntli.net...

Pegasus (MVP)

unread,
Jan 25, 2005, 5:18:32 PM1/25/05
to
The location of the switches is a matter of preference in most
(but not all!) commands. You have a whole zoo of switches
(/C/V/F/I/D/S/K/H/O/Y) - whether they are appropriate or
not is for you to decide.

If you tell me which part(s) of my script you do not understand
then I shall elaborate.

To adjust the source and target, you simply change lines
2 and 3 (see below). It's as simple as this.

@echo off
set source=E:\
set target=F:


set report=c:\Logs\backup.log
set error=c:\Logs\backup.err
if not exist c:\logs md c:\Logs

echo Backup performed on %date% at %time% > "%report%"
echo Backup performed on %date% at %time% > "%error%"
xcopy /s /y "%Source%" "%Target%\" 1>"%report%" 2>"%error%"

"Paul Westwell" <paul...@nospam.westwell.me.uk> wrote in message

news:zSyJd.304$iD3...@newsfe5-win.ntli.net...

Paul Westwell

unread,
Jan 26, 2005, 5:30:27 PM1/26/05
to
Pegasus,

Got the script working fine now.. thanks for your help.....

One final question!

When the script runs from Task Scheduler it brings up the cmd window
although nothing is displayed in it as the output is all piped to the log
file (I assume)

Is it possible to stop the cmd window opening?

Regards,

Paul


"Pegasus (MVP)" <I....@fly.com> wrote in message

news:ujyrPvyA...@TK2MSFTNGP15.phx.gbl...

Pegasus (MVP)

unread,
Jan 26, 2005, 11:38:11 PM1/26/05
to
Schedule the backup command under an account other
than your foreground account.


"Paul Westwell" <paul...@nospam.westwell.me.uk> wrote in message

news:7SUJd.991$Og3...@newsfe2-win.ntli.net...

Kelly

unread,
Jan 27, 2005, 3:03:48 AM1/27/05
to
Why not give him what he asked for?

--
All the Best,
Kelly (MS-MVP)

Troubleshooting Windows XP
http://www.kellys-korner-xp.com


"Pegasus (MVP)" <I....@fly.com> wrote in message

news:ecc6DoCB...@TK2MSFTNGP14.phx.gbl...

Pegasus (MVP)

unread,
Jan 27, 2005, 3:18:16 AM1/27/05
to
I did! If you think that I did not, let's have your commens, please.


"Kelly" <ke...@mvps.org> wrote in message
news:%23DS74aE...@TK2MSFTNGP12.phx.gbl...

Kelly

unread,
Jan 27, 2005, 3:45:35 AM1/27/05
to
Check with your lead.

--
All the Best,
Kelly (MS-MVP)

Troubleshooting Windows XP
http://www.kellys-korner-xp.com


"Pegasus (MVP)" <I....@fly.com> wrote in message

news:uPQkCjEB...@tk2msftngp13.phx.gbl...

Pegasus (MVP)

unread,
Jan 27, 2005, 7:13:41 AM1/27/05
to
Playing little games there, are you?


"Kelly" <ke...@mvps.org> wrote in message

news:euV9OyEB...@TK2MSFTNGP10.phx.gbl...

Paul Westwell

unread,
Jan 27, 2005, 12:26:25 PM1/27/05
to
I think I only have one user account at the moment, do I need to create
another?

Also is it easy to create a new logfile and error log every time the bat is
run?

Regards,

Paul


"Pegasus (MVP)" <I....@fly.com> wrote in message

news:ecc6DoCB...@TK2MSFTNGP14.phx.gbl...

Pegasus (MVP)

unread,
Jan 27, 2005, 4:31:02 PM1/27/05
to
Yes, you need to create another account, preferably
an admin account. Having only one admin account is
short-sighted: Some day something might happen to
your password, leaving you totally stranded!

You can have a different report name with the batch file
below. Depending on the value you select in "tokens=x"
(e.g. "tokens=1, tokens=2, tokens=3") you will get a
new report every day of the week or every day of the
month. Execute the following lines directly from a Command
Prompt to help you decide:

for /F "tokens=1 delims=/ " %a in ('echo %date%') do echo %a
for /F "tokens=2 delims=/ " %a in ('echo %date%') do echo %a
for /F "tokens=3 delims=/ " %a in ('echo %date%') do echo %a

Line1 @echo off
Line2 set source=E:\
Line3 set target=F:

Line4 for /F "tokens=x delims=/ " %%a in ('echo %date%') do set ID=%%a
Line5 set report=c:\Logs\backup-%ID%.log
Line6 set error=c:\Logs\backup-%ID%.err
Line7 if not exist c:\logs md c:\Logs
Line8
Line9 echo Backup performed on %date% at %time% > "%report%"
Line10 echo Backup performed on %date% at %time% > "%error%"
Line11 xcopy /s /y "%Source%" "%Target%\" 1>"%report%" 2>"%error%"


"Paul Westwell" <paul...@nospam.westwell.me.uk> wrote in message

news:5v9Kd.290$Wg4...@newsfe1-gui.ntli.net...

Paul Westwell

unread,
Jan 30, 2005, 3:24:58 PM1/30/05
to
Pegaus,

Thanks again got this going with the Day (tokens=1)

Wondered if it were possible to include all three token so it would give
date like this 30/01/2005 ?

Regards,

Paul


"Pegasus (MVP)" <I....@fly.com> wrote in message

news:Ooo7BeLB...@TK2MSFTNGP10.phx.gbl...

Pegasus (MVP)

unread,
Jan 30, 2005, 3:55:31 PM1/30/05
to
It is, but the operating system will not tolerate slashes (31/1/2005) as
file
or folder names. You have use use something else, e.g. dashes (31-1-2005).

I recommend you start experimenting yourself with these concepts.
When you type for /? at the Command Prompt then you will
get an enormous amount of help!

Line1 @echo off
Line2 set source=E:\
Line3 set target=F:

Line4 for /F "tokens=1-3 delims=/ " %%a in ('echo %date%') do set
ID=%%a-%%b-%%c


Line5 set report=c:\Logs\backup-%ID%.log
Line6 set error=c:\Logs\backup-%ID%.err
Line7 if not exist c:\logs md c:\Logs
Line8
Line9 echo Backup performed on %date% at %time% > "%report%"
Line10 echo Backup performed on %date% at %time% > "%error%"
Line11 xcopy /s /y "%Source%" "%Target%\" 1>"%report%" 2>"%error%"


"Paul Westwell" <paul...@nospam.westwell.me.uk> wrote in message

news:uobLd.247$CF5...@newsfe1-win.ntli.net...

0 new messages