To run a Cygwin script (or executable?)
from the Windows 7 Task Scheduler:
- Open the Windows Task Scheduler, e.g., search for
“task scheduler” from the Windows start menu.
- In the left-hand pane, select Task Scheduler Library or, optionally,
select one of its subfolders, creating one if desired.
(I keep my tasks under a personal subfolder I've created, for
- Select menu item Action: Create Task...
- Enter a task name in the Name: field.
- (optional) Enter a description in the Description field.
- Other things in this tab can be left as-is, although I generally
choose Run whether user is logged on or not.
- Skipping over the Triggers tab for now, select the Actions tab.
- Push the New... button.
- Make sure Action is “Start a program”; enter the
full Windows path to bash.exe (when scheduling bash scripts)
into the Program/script box:
- In the Add arguments box, enter “-l -c” and the bash command to run, e.g.,:
-l -c "/home/peter/bin/daily.sh 2>&1 >> daily.log"
In this example,
- stdout and stderr are appended to the daily.log file in the user’s $HOME directory.
- The script runs in the user’s usual bash environment; one can redirect output to local files, etc.
- Go back to the Triggers tab and specify when the script should be run.