syntax for batch file to carry out scheduled copy task

R

Robert M Jones

Win XP Home
I want to set up a simple batch file
c:\pstbak.bat
for copying an outlook data file to a backup volume and then be able to
run the batch file via Task Scheduler automatically. I am having trouble
with the syntax.

The source file is
E:\outlook data for importing\outlook.pst
The destination file is
F:\pstbak\outlook.pst

The task will "Run as.." administrator and I know how to set up the
scheduled task. It is the batch file I am struggling with.

What should my batch file look like so that Task sheduler can run it
without input and exit neatly at the end?

I have tried a test command like this in "cmd prompt" using the syntax
described in copy /? but it doesnt work - I just get a cmd window with a
prompt at the system32 directory - so there is obviously something I am
getting wrong...

C:\WINDOWS\system32\cmd.exe copy [/v][/y] "e:\outlook data for
importing\outlook.pst" [f:\pstbak\outlook.pst]

If I copy just
copy [/v][/y] "e:\outlook data for importing\outlook.pst"
[f:\pstbak\outlook.pst]
to a command prompt I get
The system cannot find the file specified.

I've played with all sorts of variations of syntax and can't even manage
a simple chdir to change to another drive so need help!
Many thanks.
--
Rev Robert M Jones, Wimborne Baptist Church, UK
http://www.wimborne-baptist.org.uk
Free trial of Mailwasher Pro - effective email spam filter - (commission
goes to our partners in Bulgaria)
http://fta.firetrust.com/index.cgi?id=420
 
G

Guest

Robert M Jones said:
Win XP Home
I want to set up a simple batch file
c:\pstbak.bat
for copying an outlook data file to a backup volume and then be able to
run the batch file via Task Scheduler automatically. I am having trouble
with the syntax.

The source file is
E:\outlook data for importing\outlook.pst
The destination file is
F:\pstbak\outlook.pst

The task will "Run as.." administrator and I know how to set up the
scheduled task. It is the batch file I am struggling with.

What should my batch file look like so that Task sheduler can run it
without input and exit neatly at the end?

I have tried a test command like this in "cmd prompt" using the syntax
described in copy /? but it doesnt work - I just get a cmd window with a
prompt at the system32 directory - so there is obviously something I am
getting wrong...

C:\WINDOWS\system32\cmd.exe copy [/v][/y] "e:\outlook data for
importing\outlook.pst" [f:\pstbak\outlook.pst]

If I copy just
copy [/v][/y] "e:\outlook data for importing\outlook.pst"
[f:\pstbak\outlook.pst]
to a command prompt I get
The system cannot find the file specified.

I've played with all sorts of variations of syntax and can't even manage
a simple chdir to change to another drive so need help!
Many thanks.
--
Rev Robert M Jones, Wimborne Baptist Church, UK
http://www.wimborne-baptist.org.uk
Free trial of Mailwasher Pro - effective email spam filter - (commission
goes to our partners in Bulgaria)
http://fta.firetrust.com/index.cgi?id=420

@echo off
copy "e:\outlook data for importing\outlook.pst" f:\pstbak\ /v /y
exit

Make sure to add a carriage return after the word exit. i.e. Press return so
the cursor is on the line below the word exit before you save the file.
 
R

Robert M Jones

Mr.Helpful said:
Robert M Jones said:
Win XP Home
I want to set up a simple batch file
c:\pstbak.bat
for copying an outlook data file to a backup volume and then be able to
run the batch file via Task Scheduler automatically. I am having trouble
with the syntax.

The source file is
E:\outlook data for importing\outlook.pst
The destination file is
F:\pstbak\outlook.pst

The task will "Run as.." administrator and I know how to set up the
scheduled task. It is the batch file I am struggling with.

What should my batch file look like so that Task sheduler can run it
without input and exit neatly at the end?

I have tried a test command like this in "cmd prompt" using the syntax
described in copy /? but it doesnt work - I just get a cmd window with a
prompt at the system32 directory - so there is obviously something I am
getting wrong...

C:\WINDOWS\system32\cmd.exe copy [/v][/y] "e:\outlook data for
importing\outlook.pst" [f:\pstbak\outlook.pst]

If I copy just
copy [/v][/y] "e:\outlook data for importing\outlook.pst"
[f:\pstbak\outlook.pst]
to a command prompt I get
The system cannot find the file specified.

I've played with all sorts of variations of syntax and can't even manage
a simple chdir to change to another drive so need help!
Many thanks.
--
Rev Robert M Jones, Wimborne Baptist Church, UK
http://www.wimborne-baptist.org.uk
Free trial of Mailwasher Pro - effective email spam filter - (commission
goes to our partners in Bulgaria)
http://fta.firetrust.com/index.cgi?id=420

@echo off
copy "e:\outlook data for importing\outlook.pst" f:\pstbak\ /v /y
exit

Make sure to add a carriage return after the word exit. i.e. Press return so
the cursor is on the line below the word exit before you save the file.

That works beautifully. Thank you VERY much

I just lost a weeks email by restoring an image I took a week ago,
forgetting that on my new XP setup the outlook data file was on the c
drive rather than my data drive, and that my Winrescue XP backup for
application data only worked on the admin account and not the user
account that Outlook works under. On my old win98SE set up I had no data
at all on the C drive - just windows and programs that would not install
elsewhere - and I forgot that things had changed - doh!
At least now I can have a daily backup to another partition volume.

Once again many thanks.

--
Rev Robert M Jones, Wimborne Baptist Church, UK
http://www.wimborne-baptist.org.uk
Free trial of Mailwasher Pro - effective email spam filter - (commission
goes to our partners in Bulgaria)
http://fta.firetrust.com/index.cgi?id=420
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top