Solved

ASimple batch file question

Posted on 2007-04-03
10
231 Views
Last Modified: 2010-04-16
Im trying to learn to write batch files primarily for backup purposes. I'd like to create a custom batch file for a few employee's who are not capble of backing their files up. So Im reading about it and trying some different things with limited sucess. I understand most of the switches.
Is there something special needed to go to say C:\Documents and settings\John Doe\My Documents because it doesn't work for me. However C:\Dell would.

Heres one that works:
xcopy /e /v /y C:\dell E:\Music
Heres one that doesn't:
xcopy /e /v /y C:\Documents and Settings\John Doe\My Documents E:\John Doe

Is it a folder attribute? A needed switch? Is there an easy way to learn\test batch files?
0
Comment
Question by:zen_68
  • 4
  • 2
  • 2
  • +1
10 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 250 total points
ID: 18845823
Spaces need to be enclosed in quotes:

xcopy /e /v /y "C:\Documents and Settings\John Doe\My Documents" E:\John Doe
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18845826
for folders with spaces, use double quotes around it:

xcopy /e /v /y "C:\Documents and Settings\John Doe\My Documents" "E:\John Doe"
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18845834
Or, you can use the short-version:

xcopy /e /v /y C:\Docume~1\JohnDo~1\MyDocu~1 E:\John Doe

or, if it's the currently logged on user,

xcopy /e /v /y "%userprofile%\My Documents" E:\John Doe
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18845835
sirbounty, you were faster, but this time too fast :-)   you overlooked the last space ---
CHeers
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18845841
Guess that first comment: "Spaces need to be enclosed in quotes:"
saved me, eh? lol :^)
0
 
LVL 32

Expert Comment

by:and235100
ID: 18845878
I wouldn't use xcopy at all.

Use robocopy - http://www.ss64.com/nt/robocopyXP.html

It has far many more options than xcopy - and is a preferred command for batch files...
0
 

Author Comment

by:zen_68
ID: 18846017
Thanks for the help guys.
Im guessing I'll be back..lol
0
 

Author Comment

by:zen_68
ID: 18846021
And I'll give robocopy a try.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18846028
Thanx. :^)
0
 
LVL 32

Expert Comment

by:and235100
ID: 18846036
Mmm - as I said before - xcopy is not the best answer - but I suppose - it is up to you, zen_68...
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question