Batch files

Jan Vicherek cygwin-user@ied.com
Fri Mar 30 14:46:00 GMT 2001


  Hmm, executing "foo.bat" works even without performing the three steps
below, but executing "foo" (where "foo.bat" is in the path), doesn't work
even if "#!.exe" is present ! :

administrator@BM80258908 /c
$ echo $PATH
/c/temp:.:/bin:/usr/bin:/sbin:/usr/sbin:/bin:/usr/bin:/sbin:/usr/sbin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/bin:/cygdrive/c/WINNT/system32:/cygdrive/c/WINNT:/cygdrive/c/vim/vim57

administrator@BM80258908 /c
$ foo.bat

c:\>echo test works ! 
test works !

administrator@BM80258908 /c
$ foo
bash: foo: command not found

 I presume that in order to make the three steps of the effect that
executing just "foo" will work, there is a prerequisite, right ?
Earnie, what would this prerequisite be ?

    thanx

	     Jan


> >/ 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


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



More information about the Cygwin mailing list