This is the mail archive of the
mailing list for the Cygwin project.
Re: Hiding console when running Cygwin utility from Task Scheduler.
- From: Brian Inglis <Brian dot Inglis at SystematicSw dot ab dot ca>
- To: cygwin at cygwin dot com
- Date: Wed, 2 Aug 2017 13:21:46 -0600
- Subject: Re: Hiding console when running Cygwin utility from Task Scheduler.
- Authentication-results: sourceware.org; auth=none
- References: <email@example.com>
- Reply-to: Brian dot Inglis at SystematicSw dot ab dot ca
On 2017-08-02 10:06, Oleksandr Gavenko wrote:
> I prepared backup task in Bash script and added task to run it in Windows Task
> Executable: c:\opt\cygwin\bin\bash.exe
> Params: c:\home\backup\backup-job.bash
> Each time job run I see console screen. 'procmon' shown that it is::
> \??\C:\Windows\system32\conhost.exe 0xffffffff -ForceV1
> Seems each Cygwin utility brings console into foreground. I also tested with:
> How can I prevent console to be shown when bash started from Task Scheduler?
Redirect all stdin from /dev/null, stdout, stderr to a log file in your script ,
# do everything inside this wrapper
} < /dev/null &> $log
or equivalent on each command if you don't have many.
Ensure you always use the correct hashbang path and the script is executable.
You might also want to change your Task Action Arguments to:
to indicate "--" end of options, there are no options, just args, and use Cygwin
paths for all file arguments.
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
I have found it useful to Cygwin symlink all cron/Task scripts to
/usr/local/bin/ and use that path for all script jobs.
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple