1.

Solve : Simple Batch File COPY?

Answer»

Hi,
I am trying to create a batch file to copy from my C drive directory to the D drive directory. I was so far able to copy a file using a simple directory listing PATH with this command:
COPY C:\Test.doc D:\

But if I try to copy a more extensive path i.e.,:
COPY C:\Document and Settings\(username)\Desktop\Test.doc D:\Documents and Settings\(username)\Desktop

the batch does not work.
Any glues on how to write this script will be welcome.
Thank you.
I see this is your second post. Welcome to Computer HOPE.


Quote from: Germain on April 05, 2008, 02:27:48 PM

... I was so far able to copy a file using a simple directory listing path with this command:
COPY C:\Test.doc D:\
^^^^^^^ has no spaces in it.

Quote
But if I try to copy a more extensive path i.e.,:
COPY C:\Document and Settings\(username)\Desktop\Test.doc D:\Documents and Settings\(username)\Desktop
^^^^^^^^^^^^^^^^ has spaces in it.

Quote
the batch does not work.
Any glues on how to write this script will be welcome.
Thank you.

Paths and/or filenames that have spaces in them necessitate the use of quote marks.

Code: [Select]COPY "C:\Document and Settings\(username)\Desktop\Test.doc" "D:\Documents and Settings\(username)\Desktop"

Let us know if that SOLVES it.


Thanks Willy. I did the CHANGE as you suggested and the script worked. Quote from: Germain on April 05, 2008, 03:46:37 PM
Thanks Willy. I did the change as you suggested and the script worked.

You're welcome.

See you later, AROUND CH here.


Discussion

No Comment Found