Run DOS command with ( ) in the dir name

This doesn't seem to work:

Run DOS command with command:  "c:\foo_(blah)\foo.exe" arguments

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

Steve

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

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

>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.) ;-).

 

> it's really a native win32 shell

It's not really the Windows Shell, either. That's something different again. 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

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. AFAIK, cmd.exe is native win32, whereas command.com is actually DOS, but even there I could be wrong.

Anyway, these steps probably should have been using “execute program” after all. :slight_smile:

Steve

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”.

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

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)…

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”…:slight_smile:

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