Ask a question Report

Batch files-space problem [Solved]

tantalus - Latest answer on Sep 2, 2010 06:53AM
Hello,
I have a problem with copying with batch files. When the source and/or destination in the xcopy command has space in itself, it won't copy. It reports "Invalid number of parameters". For example, the source is C:/NewFolder/*.* Now it copies. But if the destination is C:/New Folder/*.* it won't copy any more. Is there any sign that I can put instead of space and that the batch file recognises it as space? I assume that there is a solution for this. Please help. Thank you
Read more 
Answer
+23
moins plus
use double quotes around the source:

copy "C:/NewFolder/*.*"
ghack2k- Dec 17, 2008 03:49PM
Thank YOU! : )
Reply
Sarenzor- Jul 23, 2010 03:21AM
what if i want to add double quotes to a variable? I do not know the path as it is selected by a user, hence i cant put it directly to the source.
E.g string selected3 = dialog.filename

All i have is selected3 but i have the spacing problem, so how do i add in the double quotes then?
Reply
guset- Sep 2, 2010 06:53AM
thanks a lot
Reply
Add comment
Answer
+3
moins plus
thanx u !!!!!!!!!! i didn't know what was wrong in my command line. I searched this answer for a long time it's working ;) the "space" issue was resolved now thanx to you. gj
Add comment
This document entitled « Batch files-space problem » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.

Not a member yet?

sign-up, it takes less than a minute and it's free!

Members get more answers than anonymous users.

Being a member gives you detailed monitoring of your requests.

Being a member gives you additional options.