SPUG: FW: Perl Question

Kurt Buff KBuff at zetron.com
Tue Sep 13 10:43:01 PDT 2005

Atom Powers wrote:
> Try this, after turning the perl scrit into a batch file do:
> 'rename script.bat script.cmd'
> A cmd script is a batch scritpt; the only difference I am 
> aware of is that Windows NT decided to use "cmd" for it's 
> batch extensions when the command interpreter changed from 
> 'command.exe' to 'cmd.exe'.
> > On 9/12/05, Michael R. Wolf <MichaelRWolf at att.net > wrote:
> > I got this question from a recent student in one of the Perl classes I 
> > taught.  Anyone ever heard of such a thing or have an idea other than a
> > simple shell-like script that copies and fiddles with permissions?
> > 
> > =====================================
> > 
> > How do you convert a perl script with an extension of .pl into a Windows

> > Command Script with an extension of .CMD?
> > 
> > I know how to convert a perl script into a Windows Batch Script with
> > but I can't seem to find a similar utility for .CMD files.
> > 
> > There must be a way since a former vendor has done all of their Perl
> > in this manner.
> > 
> > Do you have any ideas?
> > 
> > --
> > Michael R. Wolf
> >     All mammals learn by playing!
> >         MichaelRWolf at att.net

While Atom is correct about the procedure, there are subtle differences, or
used to be, between cmd.exe and command.com. Also - I haven't checked this
in a while, so it may have changed - the default for double-clicking on a
.bat file would invoke command.com, and double-clicking on a .cmd file would
invoke cmd.exe, and sometimes those differences would come out to play. This
was especially frustrating when running a scheduled job that might do
different things depending on the file extension of the script.

For fun just now, from the console of my Windows 2003 Server, I did a
Start/Run of 'command' (no extension), and it launched a shell called
command.com, and it showed the following:

	Microsoft(R) Windows DOS
	(C)Copyright Microsoft Corp 1990-2001.

Launching cmd.exe in the same fashion yields:

	Microsoft Windows [Version 5.2.3790]
	(C) Copyright 1985-2003 Microsoft Corp.

The command.com shell is not really DOS any more, of course, but it's
probably safer to assume that there are still differences between it and

Michael, if your student is interested in pursuing this, have your him or
her do two things:

1) search the hard drive for the help file describing the cmd.exe shell -
it's probably ntcmds.chm, depending on the flavor of Windows.

2) Have him or her open a native Windows shell by typing cmd.exe from
Start/Run, then type 'help cmd' at the prompt.

Those should make for illuminating reading.



More information about the spug-list mailing list