Win Task Scheduler for cygwin

HowTo run bash scripts via Cygwin as Scheduled Task (i.e. “Aufgabenplanung”) in Windows

true
2020-07-07

HowTo run bash script via Cygwin as Scheduled Task (i.e. “Aufgabenplanung”) in Windows

For process automation it is not necessary to rely on Outlook reminders if you’re on Windows and cannot (or want not) run Cron as a service to schedule scripts or programs:
Windows brings its native service called “Scheduled Tasks” (or “Aufgabenplanung” in the German version)

// Open “Scheduled Tasks” App

// Set up a new Job

Right-click on an empty space in the Tasks’ overview and select “new task” (i.e. “Einfache Aufgabe erstellen”).
In “Actions” (i.e. “Aktionen”) enter the path to cygwin in the “Program/script” field, e.g.
C:\cygwin64\bin\bash.exe

In the “Add arguments” box, enter “-l -c” and the full path to the bash command to run surrounded by quotes in UNIX notation, i.e. with forward slashes and as seen from within cygwin, and not simply the Windows path, e.g.
-l -c "/tmp/pdw_test/pull_chapter_report_from_jobscheduler.sh"

 -l: Run as if logged on at a shell
 -c: Run this command

In the “Start in” field enter
C:\cygwin64\bin

Add a description and give your task a meaningful name, so that when you come back to it in a year you know what it’s for and you’re done!

Citation

For attribution, please cite this work as

Schmalfuß (2020, July 7). OS DataMercs: Win Task Scheduler for cygwin. Retrieved from https://www.datamercs.net/posts/2020-07-07-wintaskschedulerforcygwin/

BibTeX citation

@misc{schmalfuß2020win,
  author = {Schmalfuß, Olaf},
  title = {OS DataMercs: Win Task Scheduler for cygwin},
  url = {https://www.datamercs.net/posts/2020-07-07-wintaskschedulerforcygwin/},
  year = {2020}
}