Escaping "run" command line options in cygwin

I'm having trouble passing arguments via run on Windows

To demonstrate this, it looks something like this:

run C:\foo.exe /BUILD

The '/ BUILD' parameter is never passed to the executable. Does anyone know a way around this?

Thanks!

+3
source share
4 answers

The correct answer after numerous studies was to pass this through a batch file - forcing only one cmd to run, passing all the execution to a batch file.

+4
source

I do not use Cygwin much, but it is possible:

run 'c:\foo.exe /BUILD'

(if not single, then possibly double quotes?)

0

, :

run "C:\foo.exe /BUILD"

, , - , "run" /BUILD, .

0

foo.exe, , /build? info run, :

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.

- . , - :

</cygdrive/d/sandbox> $ run ls -la
</cygdrive/d/sandbox> $

, - :

</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...]

, .

. DOS, , , , XP cmd.exe " > " run ls.

0

Source: https://habr.com/ru/post/1702767/


All Articles