1. long filenames under ex.exx

Hi all,

I am writing a small command line utility that will take a folder alias, 
look up the path to that folder and either cd to that folder or launch 
explorer at that folder.

The explorer part works fine the cd part is giving me an error with long 
filenames. I am running it using ex.exe instead of exw.exe so that the 
work will happen in my current dos session.

   system("cd c:\\program files", 2) results in 
   Too many parameters - files

   system("cd \"c:\\program files\"", 2) results in 
   Parameter format not correct -  "c:\program

Any suggestion would be appreciated.

new topic     » topic index » view message » categorize

2. Re: long filenames under ex.exx

On Fri, 22 Feb 2002 22:34:13 +0000, Al Gonzalez <alg at nomscon.com>
wrote:

>
>Hi all,
>
>I am writing a small command line utility that will take a folder alias, >look
>up the path to that folder and either cd to that folder or launch
>explorer at that folder.
>
>The explorer part works fine the cd part is giving me an error with long
>>filenames. I am running it using ex.exe instead of exw.exe so that the
>work will happen in my current dos session.
>
>   system("cd c:\\program files", 2) results in 
>   Too many parameters - files
>
>   system("cd \"c:\\program files\"", 2) results in 
>   Parameter format not correct -  "c:\program
>
>Any suggestion would be appreciated.
>
Try "c:\\progra~1". This is what the dos dir command lists the file
as.

Pete

new topic     » goto parent     » topic index » view message » categorize

3. Re: long filenames under ex.exx

Al Gonzalez wrote:


To: "EUforum" <EUforum at topica.com>
Subject: long filenames under ex.exx


>
> Hi all,
>
> I am writing a small command line utility that will take a folder alias,
> look up the path to that folder and either cd to that folder or launch
> explorer at that folder.
>
> The explorer part works fine the cd part is giving me an error with long
> filenames. I am running it using ex.exe instead of exw.exe so that the
> work will happen in my current dos session.
>
>    system("cd c:\\program files", 2) results in
>    Too many parameters - files
>
>    system("cd \"c:\\program files\"", 2) results in
>    Parameter format not correct -  "c:\program
>
> Any suggestion would be appreciated.
>
Al,

The problem is that cd is a DOS command and DOS uses the space to separate
command line parameters, so the cd C:\Program Files is interperted by DOS as
"change directory to C:\Program, what the hell is that Files parameter for?"

The Solution is to get DOS to see "C:\Program Files" as DOS does not
interpret a space in a quoted string as a parameter separator and will
interpret as "Change directory to C:\Program Files, no problem."

The correct Euphoria code is

system("cd \"c:\\program files\"", 2)  -- the \"  includes a literal " in
the string

By the way, it does no harm to enclose a file or folder name in quotes if it
has no spaces, so this solution will also work for variable file/folder
names.

-- MIke Nelson

new topic     » goto parent     » topic index » view message » categorize

4. Re: long filenames under ex.exx

Al,

I didn't follow all this quoting, but may be the following tst.exw is
useful to you?:

------------------------------------------------------------
include get.e

integer  k
sequence s

-- translate this: dir "c:\Program Files\Common Files\*.*"
-- to EU-string:

s = "dir \"c:\\Program Files\\Common Files\\*.*\""

puts(1, s & "\n")
system(s,2)
puts(1,"press any key...")
k = wait_key()
------------------------------------------------------------

   I assume the directory: c:\Program Files\Common Files\ exists on your
machine.
Note that this has to be run with exw.exw, it will not work with ed.exe
!

Have a nice day, Rolf

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu