# Run DOS Command with spaces in path fails

**URL:** https://www.finalbuilder.com/forums/t/run-dos-command-with-spaces-in-path-fails/2742
**Category:** Bugs
**Created:** [December 22, 2006, 3:01am UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-spaces-in-path-fails/2742 "2006-12-22T03:01:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![peter3](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/peter3/32/28_2.png) [@peter3](https://www.finalbuilder.com/forums/u/peter3)
#### Post date: [December 22, 2006, 3:01am UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-spaces-in-path-fails/2742/1 "2006-12-22T03:01:51Z")

</div>

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

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [December 22, 2006, 6:08am UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-spaces-in-path-fails/2742/2 "2006-12-22T06:08:11Z")

</div>

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, […]”

---

<div class="post-metadata">

### Author: ![peter3](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/peter3/32/28_2.png) [@peter3](https://www.finalbuilder.com/forums/u/peter3)
#### Post date: [December 23, 2006, 12:44pm UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-spaces-in-path-fails/2742/3 "2006-12-23T12:44:35Z")

</div>

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
