Shebang line through MS DOS? 
Author Message
 Shebang line through MS DOS?

Howdy all!

When I run my Perl scripts through Cygwin (a bash shell for Windows) they
work wonderfully just like this when I include the shebang line:
   scriptName.pl arg1 arg2 ...

But when I run my Perl scripts through MSDOS in the same manner - with the
appropriate shebang line - they do not run. Instead I get a message "bad
command or file name". I would expect this if I had no file type association
set up between the Perl executable and files with the extension "pl" - but I
do.

Does anyone else have any ideas about what I need to do?

Thanks!

Rob
:)
:-}
;->



Fri, 29 Oct 2004 15:04:31 GMT  
 Shebang line through MS DOS?

Quote:
> Howdy all!

> When I run my Perl scripts through Cygwin (a bash shell for Windows) they
> work wonderfully just like this when I include the shebang line:
>    scriptName.pl arg1 arg2 ...

> But when I run my Perl scripts through MSDOS in the same manner - with the
> appropriate shebang line - they do not run. Instead I get a message "bad
> command or file name". I would expect this if I had no file type association
> set up between the Perl executable and files with the extension "pl" - but I
> do.

> Does anyone else have any ideas about what I need to do?

> Thanks!

> Rob

Rob,

Under WinNT (2000, XP, etc.) there is a system environment variable,
PATHEXT, which defines the types of files cmd.exe will look for in
your path, given a command.  Mine is defined, for instance, as
follows:

.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PL

In addition, you need to have the .pl type associated with Perl, so
that it knows what to do with this line.  The #! syntax, which works
with Cygwin shells, is strictly a Unix thing.  However, it does no
harm, and if you switch between bash and cmd regularly, leave it in.

Knowing Windows, you probably have to reboot after setting this, but
it might work instantly.

Cheers!
Jerry Oberle
perl -e 'printf "mailto%s%coberle%cearthlink%cnet%c", ":", 103, 0x40,
056, 10;'



Sat, 30 Oct 2004 21:45:25 GMT  
 Shebang line through MS DOS?
Thanks Gerard!

Quote:
>  The #! syntax, which works
> with Cygwin shells, is strictly a Unix thing.  However, it does no
> harm, and if you switch between bash and cmd regularly, leave it in.

This is very useful information that I was not aware of!

Quote:
> Under WinNT (2000, XP, etc.) there is a system environment variable,
> PATHEXT, which defines the types of files cmd.exe will look for in
> your path, given a command.  Mine is defined, for instance, as
> follows:

> .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PL

Do you know where I can find the equivalent for Win ME?

Thanks!

Rob

:)
:-}
;->



Quote:
> > Howdy all!

> > When I run my Perl scripts through Cygwin (a bash shell for Windows)
they
> > work wonderfully just like this when I include the shebang line:
> >    scriptName.pl arg1 arg2 ...

> > But when I run my Perl scripts through MSDOS in the same manner - with
the
> > appropriate shebang line - they do not run. Instead I get a message "bad
> > command or file name". I would expect this if I had no file type
association
> > set up between the Perl executable and files with the extension "pl" -
but I
> > do.

> > Does anyone else have any ideas about what I need to do?

> > Thanks!

> > Rob

> Rob,

> Under WinNT (2000, XP, etc.) there is a system environment variable,
> PATHEXT, which defines the types of files cmd.exe will look for in
> your path, given a command.  Mine is defined, for instance, as
> follows:

> .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PL

> In addition, you need to have the .pl type associated with Perl, so
> that it knows what to do with this line.  The #! syntax, which works
> with Cygwin shells, is strictly a Unix thing.  However, it does no
> harm, and if you switch between bash and cmd regularly, leave it in.

> Knowing Windows, you probably have to reboot after setting this, but
> it might work instantly.

> Cheers!
> Jerry Oberle
> perl -e 'printf "mailto%s%coberle%cearthlink%cnet%c", ":", 103, 0x40,
> 056, 10;'



Sun, 31 Oct 2004 21:10:59 GMT  
 Shebang line through MS DOS?
Thanks Jerry. My problem with NT 4.0 and perl is that standard output
is not properly redirected when a script is run without a leading
"perl".

#########example.pl#########
print "TEST";
#########END#########

running:

c:\> perl example.pl > foo.txt

c:\> type foo.txt
TEST
c:\>

c:\> example.pl
TEST
c:\> example.pl > foo.txt

c:\> type foo.txt

Any ideas?

Quote:
> Under WinNT (2000, XP, etc.) there is a system environment variable,
> PATHEXT, which defines the types of files cmd.exe will look for in
> your path, given a command.  Mine is defined, for instance, as
> follows:

> .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PL



Tue, 02 Nov 2004 23:19:23 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Shebang line question

2. NewbieQ: shebang line

3. shebang line not working

4. script that will exclude lines with shebang from text file

5. Disable Apache shebang line "feature"?

6. Trouble with shebang line ...

7. Cross-platform shebang line CGI script shenanigans - Windows and Linux with Apache

8. -s switch not recognized in shebang line

9. Shebang line -- What exactly does Perl do?

10. MS-DOS tips and tricks

11. Oraperl for MS-DOS

12. Globbing in perl for MS-DOS [OS/2]

 

 
Powered by phpBB® Forum Software