Report

Batch files-space problem [Solved/Closed]

Ask a question tantalus - Last answered on Sep 2, 2010 at 06:53 AM by guset
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
See more 
Helpful
+23
plus moins
use double quotes around the source:

copy "C:/NewFolder/*.*"
Was this answer helpful?  
ghack2k- Dec 17, 2008 at 03:49 PM
Thank YOU! : )
Sarenzor- Jul 23, 2010 at 03:21 AM
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?
guset- Sep 2, 2010 at 06:53 AM
thanks a lot
Helpful
+3
plus moins
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

Member requests are more likely to be responded to.

Members can monitor the statuses of their requests from their account pages.

A CCM membership gives you access to additional options.

Not a member yet?

Sign up now. It takes less than a minute and is completely free!