Running Windows scripts & PATHEXT

Andrew DeFaria Andrew@DeFaria.com
Tue Aug 31 01:24:00 GMT 2004


Igor Pechtchanski wrote:

> Ugh. I fully agree with CGF - the "hide the extension" business is 
> ugly, counterproductive, and should not be used.

Well Cygwin's already doing it WRT things like .exe and .lnk... :-)

> Having said that, is there any reason why
>
> $ ln -s myscript.pl myscript && chmod a+x myscript.pl
>
> doesn't do the trick? AFAIK, Windows doesn't attempt to execute files 
> with no extension, so it won't interfere with CMD, and will allow bash 
> to execute myscript.pl by typing "myscript"...

Nah it'd work. Just that I'd have to create additional links for every 
myscript I come up with! That's what I was trying to avoid.

> The situation with VB scripts is harder. I'd go for something like
>
> $ cat > myscript << EOF && chmod a+x myscript
> #!/bin/bash
> cscript /nologo myscript.vbs
> EOF
>
> if you wanted to run "myscript.vbs" by just typing "myscript". FWIW, 
> if there were a way to get Visual Basic to ignore the shebang line at 
> the top, there's a way of specifying the right script interpreter, 
> too, so that you could run "myscript.vbs" directly, but I guess VB 
> will punt on that, so I won't go into details.

Well one thing that I did was create a .cmd file that runs the .vbs with 
cscript instead of wscript but again, having to create and maintain an 
additional file (myscript.cmd calls myscript.vbs with cscript) *plus* 
have to make a symlink for myscript -> myscript.cmd (would that even 
work?!? - your example was a symlink -> a .pl file not a .cmd that calls 
a .vbs, etc....) is just getting way to messy...


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list