Running Bash Scripts in Windows Scheduler

Normally you can run scripts in the Cygwin shell. But I wanted to run a bash script in Windows scheduler. Find the Cygwin.bat file probably located in C:\cygwin. It looks something like this.


@echo off

C:
chdir C:\cygwin\bin

bash --login -i

This batch file doesn’t let you run an external script with it. Add a %1 at the bash command’s end like this. What you are doing is passing the first parameter in Windows to bash.


@echo off

C:
chdir C:\cygwin\bin

bash --login -i %1

Now drag and drop the Cygwin.bat file into the Windows scheduler window and edit running time properties etc. Now add the script to run at the end of the Cygwin command. For example like

C:\cygwin\Cygwin.bat ./bin/mysql/db.dilantha.info.sh

Windows Scheduler

Popularity: 3% [?]

Related posts:

  1. Jar Clean Up Story
  2. Make Windows Shortcuts with Cygwin
  3. Easy Passwordless Shell Logins
  4. A better ssh-copy-id | smithii.com
  5. File Sharing Between Linux and Windows

2 Responses to “Running Bash Scripts in Windows Scheduler”


  1. 1 Erik Alm

    Good advice!

    If you add “%*” instead of “%1″ you can make cygwin pass on all parameters instead of just the first.

    /E

  2. 2 Dilantha

    Thanks for the tip will try it out sometime.

Comments are currently closed.