Parameter being cut off at space
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
# 1 Re: Parameter being cut off at space
Are you unable to use single quotes?
"/XD FolderIgnore /XD 'Ignore Folder' "
# 2 Re: Parameter being cut off at space
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?
# 3 Re: Parameter being cut off at space
What programming language are you using, and what program are you passing these parameters to?
# 4 Re: Parameter being cut off at space
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?
# 5 Re: Parameter being cut off at space
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.