This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Batch files



cmd will grok it because it will look for a command called #!, which step
one instructs you to create. A note on step #2. You will want #!.exe in the
path that is set in Windows and in cgywin's bash but, it only has to be in
the path once. So, if you have added cygwin/bin to your normal windows path,
you shouldn't need to put it in windows/system32.

While we are on the topic of paths, you would really only need to add 
	#! cmd /c
as the first line of the batch file, since windows/system32 is always in the
windows path and cygwin builds it path on that.

I think I speak for many though, when I say that it would be nice to have
more intuitive support, such as it just working. I have many batch files
that I would rather not convert. Perhaps cygwin could recognize a first line
of "@echo off" as a DOS batch file and run the interpreter. Even better, and
I have wondered for a long time why I haven't seen this yet, programs could
be invoked on any file based on the results of that file's magic (see: man
file). 

________________________________
Glen Coakley, Sr. Software Engineer
MQSoftware Inc., (763) 543-4845
Have you ever wonder what happens when you run "rm -rf / " but been afraid
to try it?


> -----Original Message-----
> From: Andrew Markebo [mailto:flognat@flognat.myip.org]
> Sent: Friday, March 30, 2001 2:09 PM
> To: Earnie Boyd
> Subject: Re: Batch files
> 
> 
> Will cmd still grokk the batch-file if you have a #! on the first
> line??
> 
>         /Andy
> 
> / Earnie Boyd <earnie_boyd@yahoo.com> wrote:
> | "Larry Hall (RFK Partners, Inc)" wrote:
> | > 
> | > At 11:17 AM 3/30/2001, Matt Minnis wrote:
> | > 
> | > >Is there a way to get Cygwin to recognize that *.bat 
> files are executeable as:
> | > >fred.bat & fred (without the .bat)?
> | > 
> | > Anything's possible.  foo.bat works for me though.
> | > 
> | 
> | Hmm...  This isn't a FAQ yet?!
> | 
> | I've explained many times how to do this. 
> | 
> | 1) Create a noop program named #!.exe
> | 2) Install the it in C:/cygwin/bin and C:/windows/system32/
> | 3) Add `#! c:/windows/system32/cmd /c' to the .bat file as the first
> | line.
> | 
> | Earnie.
> | 
> | P.S.:
> | 
> | cat << EOD > noop.c
> | int main (void) {return 0;}
> | EOD
> | gcc -o \#\!.exe noop.c
> | 
> | _________________________________________________________
> | Do You Yahoo!?
> | Get your free @yahoo.com address at http://mail.yahoo.com
> | 
> | 
> | --
> | Want to unsubscribe from this list?
> | Check out: http://cygwin.com/ml/#unsubscribe-simple
> 
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple
> 

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]