Running .bat files from CYGWIN

Larry Hall (RFK Partners, Inc) lhall@rfk.com
Mon Jan 15 11:07:00 GMT 2001


At 01:50 PM 1/15/2001, Earnie Boyd wrote:
>"Larry Hall (RFK Partners, Inc)" wrote:
> > 
> > At 12:43 PM 1/15/2001, Michael Yorg wrote:
> > >I have read that CYGWIN supports running DOS .bat files but the shell seems
> > >the think that they aren't executable.  The exact error is, 'command not
> > >found'.  I've used chmod to give the file executable status and it still
> > >won't work.  Someone recommended running the .bat file from within a shell
> > >script and that didn't seem to work either.  What am I doing wrong?
> > 
> > Check the mail list archive for discussions on this.  You should be able to
> > execute batch files by invoking the command interpreter (i.e. "cmd /c b.bat"
> > on NT/W2K).  sh (ash) or bash won't know what to do with these files
> > otherwise, even if it did read them...
> > 
>
>Create a noop program named #!.exe and put it in command.com/cmd.exe
>PATH.
>Then at the top of your .bat file put
>   #! c:\\path\\to\\cmd.exe /c
>and this will cause Cygwin to think it's executable and execute it.
>
>Cheers,
>Earnie.


Right but these batch files won't run from cmd.exe/command.com like this
though.  Still, its a way to "convert" batch files to run under the Cygwin
shells if you don't need them to run under cmd.exe/command.com anymore.

The reason I directed the poster to the email archives is I seem to 
remember that there was also some way to get bash/sh to run batch files 
directly, without invoking the cmd.exe/command.com explicitly (i.e. one
could just type b.bat at the sh/bash prompt).  I don't remember the details
though (which is the part that would be in the email archives for those 
interested in looking!;-))  And actually, for me, this works.  YMMV and
don't ask me why it works for me!;-)



Larry Hall                              lhall@rfk.com
RFK Partners, Inc.                      http://www.rfk.com
118 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX



--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list