Web lists-archives.com

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

On 2017-08-02, Brian Inglis wrote:

> Redirect all stdin from /dev/null, stdout, stderr to a log file in your script ,
> like:
> 	#!/bin/bash
> 	prog=${0##*/}
> 	base=${prog%.*}
> 	log=/var/log/$base.log
> 	# do everything inside this wrapper
> 	{
> 		...
> 	} < /dev/null &> $log
> or equivalent on each command if you don't have many.

That is not the case for:

> How can I prevent console to be shown when bash started from Task Scheduler?

Closing of stdin / stdout / stderr is task for external process (like CRON)
even on UNIX.

With simple:

  #include <stdio.h>
  #include <unistd.h>

  int main(int argc, char **argv) {


      return 0;

in Task Scheduler I see console window and supporting conhost.exe process.

OK. I know about run.exe from package:

  sdesc: "Launch cmdline programs with hidden console"
  ldesc: "Launch cmdline programs with hidden console"
  category: Base
  requires: cygwin
  version: 1.3.4-2

I tried:

  $ cp /bin/run.exe ~/usr/bin/runbash.exe

and provide path to ~/usr/bin/runbash.exe in Task Scheduler. Console window
still flashes.

With my tiny test utility:

  $ cp /bin/run.exe ~/usr/bin/runxtest.exe

it flashes too from Task Scheduler but for a moment not 10 sec ))

Same if I run by Win+R:

  $ run xtest

My goal to avoid any splashes on screen and possible keyboard focus stealing
from sudden task execution.


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