Click to See Complete Forum and Search --> : Parameter being cut off at space


brokenchode
July 13th, 2006, 04:07 PM
I am having a problem where I am passing in a parameter to a batch file:

Parameter being passed:

"/XD FolderIgnore /XD "Ignore Folder" "


That is the exact parameter with spaces, but when I echo the parameter I get this:

"/XD FolderIgnore /XD "Ignore


If I remove the space : "/XD FolderIgnore /XD "IgnoreFolder" " output from echo is:

"/XD FolderIgnore /XD "IgnoreFolder" "



Is there anyway I can make it so the space is escaped? BTW I need the quotes around the Ignore Folder because another program is taking in the arguments.

thanks

PeejAvery
July 13th, 2006, 10:11 PM
Are you unable to use single quotes?

"/XD FolderIgnore /XD 'Ignore Folder' "

brokenchode
July 14th, 2006, 09:31 AM
Unfortunately I am not able to use single quotes, the program that I am passing arguments to needs to take in directory names with double quotes and not single quotes.

Any other ideas?

PeejAvery
July 14th, 2006, 10:45 AM
What programming language are you using, and what program are you passing these parameters to?

brokenchode
July 14th, 2006, 10:53 AM
I am using a vbscript to create a batch file that looks something like this:

call runbackup_days.bat "\\adamr-d\C$\code" "\\proddump1\D\itusers\AdamR\6\code" USER@EMAIL.com "\\proddump1\D\itusers\AdamR\6" bat2mail "\\adamr-d\C$\code\*" " /XD "FolderIgnore" /XD "Ignore Folder"">> \\proddump1\D\backupscripts\output2.log

runbackup_days.bat:

d:\backupscripts\robocopy.exe %1 %2 /A /A-:A /E %~7 /R:0 /W:5 /NP /ETA > %5


I take in 7 args. ON the 7th arg,
" /XD "FolderIgnore" /XD "Ignore Folder""

if the space is there, msdos thinks that its the end of the statement, when it really isn't, if there is no space it works fine.

ARG -> "/XD FolderIgnore /XD "Ignore Folder" "

msdos breaks it down to this ->"/XD FolderIgnore /XD "Ignore


That enough info to get a handle on whats going on?

PeejAvery
July 14th, 2006, 12:27 PM
Well, passing double-quotes in a batch, isn't easy. In fact, I don't think there is a work-around.

Let's see if someone else knows something.