Web lists-archives.com

Re: Hiding console when running Cygwin utility from Task Scheduler.




On 2017-08-02, Brian Inglis wrote:

> I believe that conhost, mintty, ptys, cron, and Cygwin program startup open
> handles for stdin, stdout, stderr to talk on, as those are assumed to be
> available by most programs, rather than closing anything, which could terminate
> program execution.
>
Small correction about `conhost`:

https://blogs.technet.microsoft.com/askperf/2009/10/05/windows-7-windows-server-2008-r2-console-host/
https://blogs.msdn.microsoft.com/reiley/2012/09/13/windows-8-and-conhost-exe/

It is native Windows app. I believe that it is responsible to drawing native
console and I want to hide it.

> Cygwin run allows you to run a Windows GUI program with a hidden console window.
>
I think situation a bit different. run.exe is able to "hide" console of
console app. Cygwin compiles each app as console as GUI app have no access to
stdin/stdout and can't attach to any console, as state run(1):

      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 console.
      There is no way to attach to an existing console but hide it if started
      as GUI program.

>> My goal to avoid any splashes on screen and possible keyboard focus stealing
>> from sudden task execution.
>
> I never see any windows or conhost processes running Cygwin Scheduled Tasks with
> the previous suggestions and these settings:
>
>>> You may also have to set the (o) Run whether user is logged on or not
>>> radio button, [X] Do not store password..., and [X] Run with highest
>>> privileges check boxes.
>
> where the first may be most significant in this case;

Thanks! That is. When I change from:

 [x] run only when user logged in

to:

 [x] run whether user is logged on or not

I don't see that temporary console window.


I was going to check what happen with Cygwin app launched from nssm and see
comment:

  2017-04-26: Users of Windows 10 Creators Update should use prelease build
  2.2.4-101 to avoid an issue with services failing to start. If for some
  reason you cannot use that build you can also set AppNoConsole=1 in the
  registry, noting that applications which expect a console window may behave
  unexpectedly.

  https://nssm.cc/download

So Microsoft recently changed something in its console related API...

-- 
http://defun.work/


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple