Run DOS Command with spaces in path fails

I have the following Run DOS Command in one of my projects:

Command:
%ROOTPATH%\setup\Output\ftpupload.bat

Start in:
%ROOTPATH%\setup\Output<br>
WaitForCompletion checked
Exit code must be less or equal to 0
Log output


%ROOTPATH% expands to "C:\Program Files\Borland\Projects\private\translator\trunk\src"

ftpupload.bat contains one line:

ftp -s:ftpupload.txt

I get the following error when running it:

‘C:\Program’ is not recognized as an internal or external command, operable program or batch file.
Program returned code : 1

This is with the latest FB5

Anyone know why and how to fix it?

Happy holidays!

Peter



This is not a problem with Final Builder, but an unusual quirk in how calling cmd.exe handles parameters.

If you want to run a batch with spaces in the name, use double quotes:
"%PathToBat%\MyBatch.bat"

But if you need to pass parameters, you must quote the batch, the parameters, and then double quote the entire line:
""%PathToBat%\MyBatch.bat" “Parameter1” "Parameter2""

For further explaination, go to the command line and type CMD /? and read the section that begins “If /C or /K is specified, […]”

Thanks, Mkie.

I am aware of how cmd.exe handles spaes and such and I was sure I had tried adding quotes to the path.

Strangely, when I tried it again, it worked. Don’t know what I did the last time.

Problem solved


Regards, Peter