# Run DOS command with ( ) in the dir name

**URL:** https://www.finalbuilder.com/forums/t/run-dos-command-with-in-the-dir-name/2933
**Category:** Bugs
**Created:** [November 28, 2007, 5:03am UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-in-the-dir-name/2933 "2007-11-28T05:03:09Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![stevage](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@stevage](https://www.finalbuilder.com/forums/u/stevage)
#### Post date: [November 28, 2007, 5:03am UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-in-the-dir-name/2933/1 "2007-11-28T05:03:09Z")

</div>

This doesn't seem to work:

Run DOS command with command:&nbsp; "c:\foo\_(blah)\foo.exe" arguments

I get an error that it can't find the file c:\foo\_

Steve

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [November 28, 2007, 11:35am UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-in-the-dir-name/2933/2 "2007-11-28T11:35:49Z")

</div>

Hi Steve,   
  
 If you’re running an executable you should always, always, be using the Execute Program action not the Run DOS Command action.   
  
 The Run DOS Command action is only for built-in “DOS” shell commands like dir, which don’t have a corresponding .EXE file.   
  
 The next major version of FB is going to have a huge warning about this, because at the moment it’s (understandably) easy to get mixed up.   
  
 Regards,   
  
 Angus

---

<div class="post-metadata">

### Author: ![stevage](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@stevage](https://www.finalbuilder.com/forums/u/stevage)
#### Post date: [November 29, 2007, 4:03am UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-in-the-dir-name/2933/3 "2007-11-29T04:03:47Z")

</div>

That’s not quite true. You have to use the Run DOS Command if you want any command shell (it’s really a native win32 shell, it’s not DOS at all) features, such as redirection (\>), piping (|), etc. The other reason I like using this command is that it’s easier to reproduce by hand:   
  
 1. Press F2 on the “command” property   
 2. Copy the contents of the evaluation   
 3. Open a command shell   
 4. Go to the directory specified in the “start in”   
 5. Paste   
 6.   
  
 You get the exact behaviour that FinalBuilder will execute, which helps a lot in debugging. I don’t know how to reproduce the exact behaviour of a “execute program” step. Maybe you paste into the Start | Run… window.   
  
 Why do you feel so strongly that I shouldn’t be using the “Run DOS command” action for running executables anyway?   
  
 Steve

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [November 29, 2007, 11:45am UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-in-the-dir-name/2933/4 "2007-11-29T11:45:50Z")

</div>

\>The other reason I like using this command is that it's easier to reproduce by hand:

You could always just select the action and click Alt-F5 (or Alt-F9, depending on your keybindings.) ;-).

&nbsp;

\> it's really a native win32 shell   
  
It's not really the Windows Shell, either. [That's something different again](http://en.wikipedia.org/wiki/Windows_Shell). It's a thin wrapper around the Command Prompt executable and its command interpreter.   
  
  
\>Why do you feel so strongly that I shouldn't be using the "Run DOS command" action for running executables anyway?   
  
... because it doesn't work sometimes, as you demonstrated in your bug report. It's calling cmd.exe with specific arguments, but cmd.exe isn't the most versatile tool when used this way.   
  
I understand that if you're doing a lot of piping and redirection and this may be the only way to go, so I'll see if I can convince cmd.exe to accept a pathname with brackets in the name.   
  
Regards,   
  
Angus

---

<div class="post-metadata">

### Author: ![stevage](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@stevage](https://www.finalbuilder.com/forums/u/stevage)
#### Post date: [November 30, 2007, 3:40am UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-in-the-dir-name/2933/5 "2007-11-30T03:40:27Z")

</div>

> You could always just select the action and click Alt-F5 (or Alt-F9, depending on your keybindings.) ;-).   
>   
> Heh…sometimes it’s important to be able to reproduce the action on the commandline, particularly to be able to rule out any problem with FinalBuilder. Ie, if something looks like it should run correctly, but it’s not running from FB, I need to make sure FB isn’t the problem.   
>   
> \>It’s a thin wrapper around the Command Prompt executable and its command interpreter.   
>   
> Yeah, cmd.exe, as opposed to [command.com](http://command.com). AFAIK, cmd.exe is native win32, whereas [command.com](http://command.com) is actually DOS, but even there I could be wrong.   
>   
> Anyway, these steps probably should have been using “execute program” after all. 🙂   
>   
> Steve

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [November 30, 2007, 4:07am UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-in-the-dir-name/2933/6 "2007-11-30T04:07:44Z")

</div>

The problem is that it doesn’t really have a name apart from “Command Prompt”, and “Run Command Prompt Command” doesn’t have quite the same ring to it as “Run DOS Command”.

---

<div class="post-metadata">

### Author: ![stevage](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@stevage](https://www.finalbuilder.com/forums/u/stevage)
#### Post date: [December 4, 2007, 6:34am UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-in-the-dir-name/2933/7 "2007-12-04T06:34:01Z")

</div>

Heh, fair point. You could make it just an option in the Execute Program action. Perhaps it could even warn you if it looks like you’re attempting to use shell features like |, \> etc.   
  
 Steve

---

<div class="post-metadata">

### Author: ![martin.lanza](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/858c86/32.png) [@martin.lanza](https://www.finalbuilder.com/forums/u/martin.lanza)
#### Post date: [December 5, 2007, 3:42am UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-in-the-dir-name/2933/8 "2007-12-05T03:42:26Z")

</div>

Just idle curiosity, what happens when I’m using BASH as my command shell? It’s possible to replace the MS-cmd with BASH (I have linux bigot friends)…

---

<div class="post-metadata">

### Author: ![stevage](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@stevage](https://www.finalbuilder.com/forums/u/stevage)
#### Post date: [December 5, 2007, 4:00am UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-in-the-dir-name/2933/9 "2007-12-05T04:00:15Z")

</div>

Heh, if anyone cans answer the question “what happens”, you can. I think FB is calling cmd.exe directly, so it presumably would have no effect.   
  
 Steve   
 PS I can relate to having “linux bigot friends”…🙂

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [December 5, 2007, 5:20am UTC](https://www.finalbuilder.com/forums/t/run-dos-command-with-in-the-dir-name/2933/10 "2007-12-05T05:20:56Z")

</div>

From memory, the action uses the value of the ComSpec environment variable to know what program to run. If that environment variable points to Bash, it will try to run bash.   
  
 However, it will run bash.exe with the arguments for cmd.exe, so it probably won’t work.   
  
 Regards,   
  
 Angus
