tags:

views:

345

answers:

4

Hey everyone,

I'm having issues passing arguments through "run" to the windows side

To demonstrate, it looks something like this:

run C:\foo.exe /BUILD

The '/BUILD' parameter is never passed to the executable. Anyone know of a way to get around this?

Thanks!

A: 

I don't use Cygwin a lot, but possibly:

run 'c:\foo.exe /BUILD'

(if not single- then maybe double-quotes?)

JMD
No luck there, forgot to mention that =]
uidzer0
A: 

Have you tried enclosing it in quotes like:

run "C:\foo.exe /BUILD"

I wonder if the shell's getting confused who the argument belongs to - that is, "run" is consuming the /BUILD, not passing it along.

lc
A: 

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.

Joe Casadonte
A: 

The correct answer, after lots of research was to pass this through a batch file - forcing 'run' to only execute a single cmd, passing all execution off to the batch file.

uidzer0