Linux is known for its unique command line, and so cygwin was made for Windows to emulate linux on windows and give windows users what they have been missing out on.
So here is how you would make a bat script start a linux(cygwin really) script. You cant in windows just click on an .sh script and expect it work unless you have something special i didnt hear of yet.
Requirements:
Cygwin Installed to where ever (You don’t need to mess with the Windows path… thats optional and not required here since I am showing you everything with full path names)
The Bat script needs to have Windows Line Endings (CR+LF)
Linux/Cygwin scripts needs to have Linux Line Endings (LF)
*SIDE NOTE ON LINE ENDINGS: Line endings can be converted to the right format with Notepad++ just go Edit->EOL Conversion->Unix for LF and for CR+LF click on Dos or Windows), to see if you have the right line endings go to the View menu->Show Symbol->Show all Characters
The syntax is like this:
<windows path to bash in cygwin> -l -c “<cygwin/linux path to the script1>”
Example:
Lets say I want to start a script called script1.sh
I usually call it like:
Script1-Windows-Starter.Bat
C:\cygwin\bin\bash.exe -l -c “/cygdrive/e/scripts/start.sh”
Note that windows is not case sensitive but linux is…
So these would work
C:\cygwin\bin\bash.exe -l -c “/cygdrive/e/scripts/start.sh”
C:\CYGWIN\bin\bash.exe -l -c “/cygdrive/e/scripts/start.sh”
C:\cyGWin\BIN\baSH.exe -l -c “/cygdrive/e/scripts/start.sh”
But these will not work – because the /cygdrive.. part doesnt match the case of the folders from cygwins/linuxes point of view:
C:\cygwin\bin\bash.exe -l -c “/cygdrive/e/SCRIPT/start.sh”
C:\CYGWIN\bin\bash.exe -l -c “/cygdrive/E/scripts/start.sh”
C:\cyGWin\BIN\baSH.exe -l -c “/cygdrive/e/scripts/START.sh”