What is foo.exe supposed to do, and how do you know it's not getting the /build command line option? If you do info run
you'll get:
Windows programs are either GUI programs or console programs. When
started console programs will either attach to an existing console
or create a new one. GUI programs can never attach to an exiting con-
sole. There is no way to attach to an existing console but hide it if
started as GUI program.
run will do this for you. It works as intermediate and starts a pro-
gram but makes the console window hidden.
That last bit is important -- it's hiding the console window. So, you'll see something like this:
</cygdrive/d/sandbox> $ run ls -la
</cygdrive/d/sandbox> $
but if you run this instead, you'll see something different:
</cygdrive/d/sandbox> $ cat foo.lst
cat: foo.lst: No such file or directory
</cygdrive/d/sandbox> $ run ls -la >foo.lst
</cygdrive/d/sandbox> $
</cygdrive/d/sandbox> $ cat foo.lst
total 9272280
drwx------+ 15 jcasadonte ???????? 0 Feb 7 10:39 .
drwxrwxr-x+ 14 Administrators SYSTEM 0 Feb 7 00:44 ..
-rwx------+ 1 jcasadonte ???????? 26300 Apr 10 2006 ATT01779.jpg
[...etc...]
The first command is running, but it's printing to a non-existent console window.
NOTE: I would have done the example with a DOS command interpreter, as it seems you are trying to do, but the XP cmd.exe doesn't handle the '>' correctly, and hands it to run
instead of ls
.