If No. 1 is true, then I need to find out how to suppress the console from a perl EXE and still get STDOUT if run from a command line. Anybody know how to do this or what's going on?

In general, what you're asking for is not possible with windows, whether in a perl EXE or not. If a windows executeable is marked as a gui executeable, it is given no access to the console when launched from the command line; if it is not marked as a gui application, it is always given a console, creating one if necessary. You can close it right away, but it'll still flash briefly on the screen.

That being said, there is a function new in Windows XP (and Windows Server 2003) that lets you re-attach to the parent console. But you don't really want to do that, because your output will get messed up with the command prompt, and you still can't do something like pipe your output through more, etc.

So instead, use the workaround suggested in this article (in the answer to the second question). That is, create two executeables, one as a gui application and one as a console application, and name the console version the same thing as the gui but with the name ending in .com, not .exe. Put the pretty icon on the .exe version. Then, when run from the command line, the .com version will get run (since windows searches for .com before .exe), but when people click things they'll click on the .exe.

Filling in the rough edges here is left as an exercise for the reader, such as launching the pure-GUI version (or detaching from the console in some other manner) when they don't specify -verbose on the command line, etc. (the article touches on some of that)

This ugly workaround is what Microsoft does with .Net (mentioned in the article).


In reply to Re: STDOUT and a PAR --gui executable by fizbin
in thread STDOUT and a PAR --gui executable by crabbdean

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.