Problem with DOS paths in perl - cmd.exe vs. command.exe

Problem with DOS paths in perl - cmd.exe vs. command.exe

Post by slinderste » Fri, 18 Jun 2004 02:54:44


Hi,

I've got the following two line perl program that I run on a Windows
XP Pro system:

print `c:\\windows\\system32\\cmd.exe /c dir c:\\documents and
settings\\me\\Desktop` ;

print `dir c:\\docume~1\\me\\desktop` ;

When I run it the first line produces an error: The system cannot find
the file specified. The second line produces the desired output.

I'm confused because cmd.exe supports spaces in directory paths yet
it's not supporting them in this perl program.

Any idea on how I can get perl to do the right thing with backticks
and paths in DOS?

Thanks,
Sol
 
 
 

Problem with DOS paths in perl - cmd.exe vs. command.exe

Post by Purl Gur » Fri, 18 Jun 2004 03:20:39


Spaces are argument delimters. Give this a bit of thought.

Reseach, read and learn how to correctly format MSDOS command line arguments.

I could quote some examples provided, but you will learn better by researching
and finding those comments by others, which you may quote here, if you like,
and do consider quoting those paths found to documents and settings you find
through your research; many will benefit from those quotes.

To avoid this problem, never allow spaces in directory names, and
always limit both directory names and file names to eight characters
plus three for file extensions.

If you are to use MSDOS, you must learn how to use MSDOS.


Purl Gurl
--
Most Entertaining Android In Existence!
http://www.yqcomputer.com/ ~ *** /roberta/roberta.cgi

 
 
 

Problem with DOS paths in perl - cmd.exe vs. command.exe

Post by Andre Wisn » Fri, 18 Jun 2004 03:21:46

On 16 Jun 2004 10:54:44 -0700, Sol Linderstein < XXXX@XXXXX.COM >



The spaces are the problem nevertheless. Try it with:

print `c:\\windows\\system32\\cmd.exe /c dir "c:\\dokumente und
einstellungen\\me\\desktop"`;
^^^ german xp
;-) ^^^


--
Andre

---

Fighting for peace is like f..ing for *** ity
 
 
 

Problem with DOS paths in perl - cmd.exe vs. command.exe

Post by Matt Garri » Sat, 19 Jun 2004 11:49:49


settings\\me\\Desktop` ;

Why are you calling cmd.exe in the first example? You only need to call dir
with the file name quoted:

print `dir "c:\\documents and settings\\me\\Desktop"`;


Prescient advice, twenty years ago...


If you are to respond to posts, learn how to read the posts. Where did he
make mention of MS-DOS? He's asking about the command shells in XP. I would
have thought you'd have figured out the difference by now. Oh wait, no I
didn't. Never mind...

Matt
 
 
 

Problem with DOS paths in perl - cmd.exe vs. command.exe

Post by Purl Gur » Sat, 19 Jun 2004 12:59:40

Matt Garrish flaunts his ignorance while trolling:




(snipped)




"Problem with DOS paths in perl - cmd.exe vs. command.exe[sic]"


Ignorant illiterate troll.


Purl Gurl
 
 
 

Problem with DOS paths in perl - cmd.exe vs. command.exe

Post by Matt Garri » Sat, 19 Jun 2004 13:10:33


We know what you are...

Matt