Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello world,
I have two problems. Firstly:
In its current form, my batch file gets the job done, but I get a few sharing violations. I don't have any desire to back up these files, but they stall the script. I'd like to skip these files, but when I add an exclude list, it excludes every file in the parent directory in that line of the script. (Obviously my syntax is wrong.)Second, If a customer is a heavy outlook user, they will be unable to open outlook until the batch completes, because the .psts don't copy correctly if they're in use. What I would like to do is make the first line of my script backup the psts, and exclude the psts from the line that backs up the Application Data parent directory to minimize their outlook downtime.
This is my script:
REMThe following line needs an /exclude for ntuser.dat
xcopy "C:\docume~1\%username%\local settings" "P:\Backup\Hidden Files" /e /y /d /r /i /h
REMThe following line needs an /exclude for .pst
xcopy C:\docume~1\%username%\applic~1 "P:\Backup\hidden files" /e /y /d /r /i /hxcopy "C:\docume~1\%username%\my documents" "P:\backup\User Data" /e /y /d /r /i /h
REMThe following line needs an /exclude of .mdf
xcopy "C:\program files" "P:\backup\Program Files" /e /y /d /r /i /h
exitAny help is appreciated. As an inexperienced user, I'm open to any suggestions of how to improve my script.
*Edit*
Added use of %homepath%

REMThe following line needs an /exclude for .pst xcopy C:\docume~1\%username%\applic~1 "P:\Backup\hidden files" /e /y /d /r /i /hecho .pst>exc xcopy C:\docume~1\%username%\applic~1 "P:\Backup\hidden files" /e /y /d /r /i /h /exclude:excI'd like to skip these files, but when I add an exclude list, it excludes every file in the parent directory in that line of the script. (Obviously my syntax is wrong.)
Agreed.
A better answer requires more information.

Such as the input you're giving it, and what part of the output is unexpected (ie the full paths of files excluded that you want to copy).

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |