Link to home
Start Free TrialLog in
Avatar of edgeit
edgeit

asked on

Simple xcopy backup script

Hi I have been trying to develop a batch file that will backup multiple directories of a users profile and work files.

I have a directory in the root of the drive named work and then I would like to copy outlook email pst files, my docs, desktop and favourites. I have seen may ways on various websites but my own scripts always fail! For instance;

I would like to backup via a external USB hard-drive with ther drive letter F:

I have tried
xcopy "%userprofile%\Desktop\"*.* F:\Backup\Desktop /s /c /d /e /h
pause

and nothing happens.

If I go to the command line Run - cmd

it shows c:\documents and settings\user:

if I manually point to F:\backup\Desktop\ from the cmd promt

it shows f:\backup\desktop:

I then try
xcopy "%userprofile%\Desktop\"*.*   /s /c /d /e /h
 it works!

Is there something fundemental that I'm missing? I have already created the destination folder "desktop" on the F: drive

Any ideas?

Avatar of jvuz
jvuz
Flag of Belgium image

Why do you use quotes: xcopy "%userprofile%\Desktop\"*.* F:\Backup\Desktop /s /c /d /e /h
Avatar of dbrunton
I have tried
xcopy "%userprofile%\Desktop\"*.* F:\Backup\Desktop /s /c /d /e /h
pause

and nothing happens.

What do you see on the screen when you execute your batch file?
ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial