95 pts.
 Batch File
I need a Batch file that will help me backup my outlook pst files so I can schedule it to do the backup everyday at a particular time. I tried creating one but it wasnt successful. Please can anyone help me to write one that will run correctly. Thanks.

Software/Hardware used:
ASKED: April 3, 2008  11:18 AM
UPDATED: September 25, 2008  10:21 AM

Answer Wiki:
You can use xcopy and also the task scheduler to manage the event. These are both part of the Windows OS. xcopy has lots of switches: Copies files and directory trees. XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W] [/C] </i> [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U] [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/EXCLUDE:file1[+file2][+file3]...] source Specifies the file(s) to copy. destination Specifies the location and/or name of new files. /A Copies only files with the archive attribute set, doesn't change the attribute. /M Copies only files with the archive attribute set, turns off the archive attribute. /D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time. /EXCLUDE:file1[+file2][+file3]... Specifies a list of files containing strings. Each string should be in a separate line in the files. When any of the strings match any part of the absolute path of the file to be copied, that file will be excluded from being copied. For example, specifying a string like obj or .obj will exclude all files underneath the directory obj or all files with the .obj extension respectively. /P Prompts you before creating each destination file. /S Copies directories and subdirectories except empty ones. /E Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T. /V Verifies each new file. /W Prompts you to press a key before copying. /C Continues copying even if errors occur. /I If destination does not exist and copying more than one file, assumes that destination must be a directory. /Q Does not display file names while copying. /F Displays full source and destination file names while copying. /L Displays files that would be copied. /G Allows the copying of encrypted files to destination that does not support encryption. /H Copies hidden and system files also. /R Overwrites read-only files. /T Creates directory structure, but does not copy files. Does not include empty directories or subdirectories. /T /E includes empty directories and subdirectories. /U Copies only files that already exist in destination. /K Copies attributes. Normal Xcopy will reset read-only attributes. /N Copies using the generated short names. /O Copies file ownership and ACL information. /X Copies file audit settings (implies /O). /Y Suppresses prompting to confirm you want to overwrite an existing destination file. /-Y Causes prompting to confirm you want to overwrite an existing destination file. /Z Copies networked files in restartable mode. The switch /Y may be preset in the COPYCMD environment variable. This may be overridden with /-Y on the command line. Maybe you can provide the batch file for review here.
Last Wiki Answer Submitted:  April 3, 2008  1:06 pm  by  Labnuke99   32,630 pts.
All Answer Wiki Contributors:  Labnuke99   32,630 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Will XCOPY fail if the end user forgets to close down Outlook? That’s a concern I have with my own situation (working in a research facility where people usually leave their machines running 24/7 while experiments are in progress).

I have been experimenting with using NTBackup on a schedule for the same thing, since it makes use of the Shadowcopy service.

This was the reference I am currently working on:

http://www.neurophys.wisc.edu/comp/blog/bb20070403_01.asp

Though I have not gotten around the fact that NTBackup actually launches even though it’s called from a batch file. I have yet to find a way to make this run invisibly to the user if they are present. (And sadly, many are present at strange hours.)

 515 pts.

 

Thanks for your answer.
This is the file i created. After closing outlook, it just goes off, not doing anything.

taskkill /im outlook.exe

xcopy “C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst” “Z:\outlook.pst /y

 95 pts.

 

Does the user have the ability to copy to the Z: location? Can you manually copy the file using the same command? I would also add the /V switch to verify the file as it copies. /F may also be useful to ensure the correct filenames are displayed.

Your batchfile is missing a quote after the Z:\outlook.pst:

xcopy “C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst” “Z:\outlook.pst /y

 32,630 pts.

 

Lonewolf – that is an excellent reference! Thanks for sharing. As you suggest, the one thing that is missing is automatically shutting down the outlook.exe application. Jjjjjj has found a way to do that it seems. You can also consider using one of the Microsoft Sysinternals tools called pskill.exe to perform this task immediately before kicking off the backup script. Let us know how it works.

 32,630 pts.

 

 

hi jjjjjjj

this batch didn’t work out coz their is a invalid parameters the xcopy cant support the space between the “Documents and Settings” so all you have to do is copy the outlook.pst to c:\outlook\ and create this batch file that i have gave you

——————————
taskkill /im outlook.exe

xcopy “C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst” “Z:\outlook.pst /y
———————————–
this well work 1000% i have try it so good luck :-)

@echo off
taskkill /f /t outlook.exe
echo Starting copy operation
cd C:\Outlook\Outlook.pst
xcopy *.* /s /e /y /c z:\Outlook\
echo Copy operation complete
pause > nul

 35 pts.

 

sorry jjjjjjjjjjjj
i have to tell you must configured the outlook to the new location .

good luck :->

 35 pts.