zen_68
asked on
ASimple batch file question
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?
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or, you can use the short-version:
xcopy /e /v /y C:\Docume~1\JohnDo~1\MyDoc u~1 E:\John Doe
or, if it's the currently logged on user,
xcopy /e /v /y "%userprofile%\My Documents" E:\John Doe
xcopy /e /v /y C:\Docume~1\JohnDo~1\MyDoc
or, if it's the currently logged on user,
xcopy /e /v /y "%userprofile%\My Documents" E:\John Doe
sirbounty, you were faster, but this time too fast :-) you overlooked the last space ---
CHeers
CHeers
Guess that first comment: "Spaces need to be enclosed in quotes:"
saved me, eh? lol :^)
saved me, eh? lol :^)
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...
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...
ASKER
Thanks for the help guys.
Im guessing I'll be back..lol
Im guessing I'll be back..lol
ASKER
And I'll give robocopy a try.
Thanx. :^)
Mmm - as I said before - xcopy is not the best answer - but I suppose - it is up to you, zen_68...
xcopy /e /v /y "C:\Documents and Settings\John Doe\My Documents" "E:\John Doe"