22 August, 2013

XCOPY on paths with space

Xcopy | 17th Feb (3/28)
Xcopy | 17th Feb (3/28) (Photo credit: Rob Hayes.)
22-August-2013


I have missed posting a number of articles, and many things that I should have noted down, I have failed to note down. I would recall that this blog was created with the intent of having my own resource later on, and having it published online, also for others who may be looking for the answer(s) to the same question(s) they have in mind.

I must admit that a lot of the important things that I should have logged down, I have forgotten - now that my web applications are running. And that is, even if I still have the links I to the reference articles and posts from other developers like me. Shame...

So just to break the silence, let me just note this down. And hope it helps many others.

I came across the problem of the need to copy some files to other PCs, and I thought it should be a very normal thing. "Easy," I thought to myself. Well, not so, because the file path of both the source and the destination have spaces. The moment I ran my batch file, I got the error(s).

I searched, "xcopy file path with space", and the top few links, I checked. I got what I wanted. The file path with space is simply needing a double quote enclosure. That is like

C:\Program Files

becoming

"C:\Program Files"

and all other definitions or switches remain the same.

Very simple solution, isn't it?

I should now say, till then!

Reference:
using XCOPY when directory has a space in name
Enhanced by Zemanta

No comments:

Post a Comment