How do i start Mintty and run a script file? How do i start Mintty and run a script file? curl curl

How do i start Mintty and run a script file?


For whoever is interested in this... here is the solution

Create a shortcut in windows for mintty with the following target

Assuming your shell file is located in c:\cygwin\bin

C:\cygwin\bin\mintty.exe /bin/bash -l -e '/cygdrive/c/cygwin/bin/test.sh'


Try running bash.exe directly (or some other shell that installed with cygwin).

From a windows shell, change directory to your cygwin install and run this:

C:\cygwin\bin>bash.exe /cygdrive/c/cygwin/bin/test.sh

To get the shell script to run by double clicking a shortcut

1) Put the command in a .bat file

test.bat---------------------------------------------------------------------c:\cygwin\bin\bash.exe /cygdrive/c/cygwin/bin/test.sh---------------------------------------------------------------------

2) Create a shortcut using test.bat as the target.

I tried making a shortcut with bash.exe and the command as a target. That errors out for some reason. However, wrapping the command in a .bat file works. Go figure.


I also use the solution offered by nkman, but I add the '-h always' option so that the console remains opened until I hit enter, to see what happened. So this is the target of my shortcut:

C:\cygwin\bin\mintty.exe -h always /bin/bash -l -e '/cygdrive/c/cygwin/home/Administrator/startup.sh'