Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 838
  • Last Modified:

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?

0
edgeit
Asked:
edgeit
1 Solution
 
jvuzCommented:
Why do you use quotes: xcopy "%userprofile%\Desktop\"*.* F:\Backup\Desktop /s /c /d /e /h
0
 
dbruntonCommented:
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?
0
 
David Johnson, CD, MVPOwnerCommented:
this works for me
xcopy "%userprofile%\Desktop\*" e:\temp  /c /m /s /d /e /h

I use the /m to only copy modified files (resets the archive bit)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now