This is the mail archive of the
mailing list for the Cygwin project.
Re: Automating a Cygwin Script From Windows
- From: Jeremy Bopp <jeremy at bopp dot net>
- To: cygwin at cygwin dot com
- Date: Fri, 28 Aug 2009 15:26:14 -0500
- Subject: Re: Automating a Cygwin Script From Windows
- References: <email@example.com>
> I need to run a cygwin script directly via windows, probably via dos prompt
> or some other comparable method. This method needs to be automated and
> kicked off in Windows at certain times, so executing Cygwin, then manually
> typing in the script to run in the Cygwin prompt is out of the question.
> I was hoping there would be some way to execute Cygwin and concurrently feed
> it a string of commands to execute upon opening, but unfortunately I have
> not had success with this. There seems to be lots of command line options
> for setting display options but nothing that would allow me to feed in a
> Is there any method to do this? Thanks for your time.
I think you might be getting the shortcut you use to start the Bash
shell confused with the emulation layer which is Cygwin. If you have a
*Bash* script which you need to run, you can use the bash.exe program
installed as part of Cygwin to run it.
Assuming you installed Cygwin to the default location, you can run the
script as follows:
The only other thing you may need to do is modify your PATH environment
variable so that any programs that script tries to run can be found. In
that case you may want to do the following in your batch file or
whatever you're using to kick off the script:
This will ensure that programs such as ls, mkdir, etc. are able to be
found by the script when used.
Please note that you should try to avoid using a Windows-style absolute
path such as C:\path\to\your\script.sh when passing the path to
bash.exe. It will probably work, but it could also cause confusing
issues. Use forward slashes (/) instead of backslashes (\) and relative
paths rather than absolute to keep things simple.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple