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 /h
xcopy "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
Any help is appreciated. As an inexperienced user, I'm open to any suggestions of how to improve my script.
Added use of %homepath%