SPUG: One-liners on Windows via command.com

John Costello cos at indeterminate.net
Wed Mar 23 14:08:55 PST 2005

On Wed, 23 Mar 2005, Tim Maher wrote:
[Tim's conundrum with command-line perl on Windows]
> I had expected some indication that command.com wouldn't know what
> to do with the SQ, as opposed to an indication that Perl only got
> a single one in -e's argument!  Can somebody explain what SQs do in
> this shell?

Be advised that "Start > Run > Command" and "Start > Run > Cmd" give you 
different command interpreters with different behavior as far as 
respecting full filenames vs. requiring 8.3 and a few other odd behaviors.  
I'll see if I can find a comparison of the two.

As far as Perl's command-line interpretation of SQ and DQ is concerned, 
perl doesn't seem to behave differently under command.com and cmd.exe.

> So now I'm wondering, do DQs in this shell allow any interpolations? 
> If so, what Perl symbols would need to be quoted to suppress that?
> Where does one get documentation on the workings of this shell?

Windows XP includes some help files for the cmd shell.  It is much more 
useful than previous versions of Windows (not that that is saying a lot).

Start with 

	help cmd 

> Can somebody point me to their favorite tutorial covering the use
> of command-line Perl techniques with Win32 systems?

Unfortunately, I haven't encountered this issue and haven't had many 
instances of dealing with cmd-line perl on win32.

"Learning Perl on Win32" says, on the topic of the command 
line, that one should check out the perlrun documentation.  perldoc 
perlrun does show MS-DOS specific examples. 

Okay, after a bit of googling and looking at my Start menu (d'oh!) I found 
some info that might be useful for you.

Select "Start > Help and Support".  
In the search dialog box, type "CMD" and hit the green arrow button.
Click on the suggested topic "CMD".  A page will display with info about 
Scroll to the bottom of the page and click "Related Topics".  A dialog box 
will pop up.
Select either "Command shell overview" or "Command-line reference A-Z" and 
read them.  I think that is your best resource.

There is far less info for "command prompt" which is the older command.com 

I also found interesting info from the following page (look under "Usage 
Hints for Perl on Win32")

A note from the Python Dev list claims that CMD.EXE can handle quoting 
rules in two different ways (!) depending on an option to cmd.exe or a 
registry setting.
They appear to be referring to the /C and /K flags to cmd.exe (see 'help 
cmd' on your XP system).

> TIA,
> -Tim

John (running back to his *NIX perl)

John Costello - cos at indeterminate dot net

More information about the spug-list mailing list