This is the mail archive of the
mailing list for the Cygwin project.
Re: run.exe flashes non-hidden console window in cygwin64 on Win7Pro-64
- From: John Wiersba <jrw32982 at yahoo dot com>
- To: Doug Henderson <djndnbvg at gmail dot com>, "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Thu, 23 Oct 2014 12:12:28 -0700
- Subject: Re: run.exe flashes non-hidden console window in cygwin64 on Win7Pro-64
- Authentication-results: sourceware.org; auth=none
- References: <1413488630 dot 82429 dot YahooMailNeo at web162806 dot mail dot bf1 dot yahoo dot com> <544055FF dot 2030604 at cs dot umass dot edu> <1413517183 dot 86611 dot YahooMailNeo at web162801 dot mail dot bf1 dot yahoo dot com> <1413517863 dot 36122 dot YahooMailNeo at web162806 dot mail dot bf1 dot yahoo dot com> <54411638 dot 2000104 at cs dot umass dot edu> <1413910316 dot 59036 dot YahooMailNeo at web162803 dot mail dot bf1 dot yahoo dot com> <1245475041 dot 20141022173600 at yandex dot ru> <1414010093 dot 92003 dot YahooMailNeo at web162802 dot mail dot bf1 dot yahoo dot com> <CAJ1FpuM=aDE0tAPb5Ez_TwW87j8ypBWp_RncETFaDQdNYLYYzA at mail dot gmail dot com> <1606505198 dot 20141023052833 at yandex dot ru> <1414037878 dot 2285 dot YahooMailNeo at web162805 dot mail dot bf1 dot yahoo dot com> <1414067059 dot 70749 dot YahooMailNeo at web162802 dot mail dot bf1 dot yahoo dot com> <CAJ1FpuMzZ6_KJqZVFjvW0gnXHXmvvWFzy6D0MSo9ZaS0mXsT8Q at mail dot gmail dot com>
- Reply-to: John Wiersba <jrw32982 at yahoo dot com>
I use cygstart.exe to start windows programs (such as winword or notepad) from
a mintty/bash console in a way that allows the mintty console to be closed
while the windows application is still active.
I thought run.exe was meant to be used from shortcuts to run cygwin programs
without flashing a console window on the desktop. I don't think it's needed
to start programs from a mintty console.
> From: Doug Henderson <email@example.com>
>To: "firstname.lastname@example.org" <email@example.com>
>Sent: Thursday, October 23, 2014 2:34 PM
>Subject: Re: run.exe flashes non-hidden console window in cygwin64 on Win7Pro-64
>On 23 October 2014 06:24, John Wiersba > wrote:
>> Maybe I'm confused. Isn't the purpose of run.exe to start a
>> cygwin program without creating a (visible) console window?
>> I can just start a cygwin program directly without the indirection of
>> run.exe if I don't care about the random flashing console window.
>> From the run.exe manpage:
>> run will do this for you. It works as intermediate and starts a program
>> but makes the console window hidden.
>AFAIK, all programs that run in Windows need a window handle in order
>to receive events, and to pass to a lot of windows functions. If your
>program create a windows before it tries to do anything that requires
>a window, that window gets used. When your program does not create its
>own windows, the start up code tries to attach you to an existing
>console window, and if there is not one, it creates it.
>A Windows GUI program starts at winmain(). This entry point does not
>have the same requirements as the C standard main() entry point.
>Mainly, you do not have the stdin, stdout, and stderr attached to
>anything, and you do not have a window. Creating a console or GUI
>window is entirely up to your code.
>Normally, any non-GUI program will attach to the console window where
>it starts. A "dos" type program will attach to the window running the
>cmd.exe that started it, and a cygwin program will get attached to the
>mintty console window to which your shell is attached,
>For both types of non-GUI programs, the msvcrt.dll or cygwin1.dll
>runtime code will setup stdin, stdout and stderr before entering
>main(). The runtime startup code will create a console window for you
>if you did not inherit one from your parent process, and the code will
>attach those file pointers to the console window
>In any system: Windows, cygwin, linux, or whatever, to create a
>windowless process, you close those initial file pointers or file
>handles and fork a new process. In the original process, you close
>your window if necessary, you call exit(), and the runtime will close
>your window if necessary. In the new process, you do what ever you
>When you have a cmd.exe window, you use "start" to fire off a new
>program and control what happens to its window with command line
>When you have a shell in a cygwin console, you use "run.exe" at the
>When you use a shortcut, you have not initial window, so the
>msvcrt.dll runtime creates one for you, and uses the properties of the
>shortcut to control how that window is created.
>At the shell prompt, try the following commands:
>$ /cygdrive/c/windows/system32/notepad.exe &
>$ run /cygdrive/c/windows/system32/notepad.exe
>$ run /cygdrive/c/windows/system32/notepad.exe &
>use ps to check how the notepad process is connected to cygwin. Try
>exiting the shell after the second command to see why you want to use
>Anyway, that's how I think things work. But I may be wrong. It may
>give you some ideas on where to look for more correct and/or detailed
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple