Search code examples
bashbatch-filecygwin

Cygwin running script from one batch file?


I know when Cygwin installs there is a batch file that is used to launch it in Windows. But if I want to run a script without launching Cygwin and doing "./script"

How do I create a batch file to do that?

As in... just have one batch file that when clicked, opens Cygwin and runs the shell script.


Solution

  • To run "foo.bsh", create a batch file with the following contents and run it:

        set PATH=C:\cygwin\bin;%PATH%
        c:\cygwin\bin\bash.exe c:\path\to\foo.bsh
    

    The "C:\cygwin\bin" part can differ depending on your chosen install location of cygwin.