1. What is the reason for this?

Hi,

In the course of some experimentation in WinXP with sending commands to cmd.exe,
I found this situation:

If I use RUN cmd to bring up the console for commands in NT-style OS, and type
in echo. > "c:\long dir name\long file name.txt" it creates the file named "long
file name.txt" in the correct directory and adds three bytes 20 0D 0A.  But if I
use the system command in an Eu ".ex" file sending this:
system("cmd echo. > "&dQuote&fullPath&dQuote,2) then it fails.  What is the
actual difference between typing a command into the console, and sending the same
command via a system() call?

Thanks,

--Quark

new topic     » topic index » view message » categorize

2. Re: What is the reason for this?

DB James wrote:
> In the course of some experimentation in WinXP with sending commands to
> cmd.exe, I
> found this situation:
> 
> If I use RUN cmd to bring up the console for commands in NT-style OS, and type
> in echo.
> > "c:\long dir name\long file name.txt" it creates the file named "long file
> > name.txt"
> in the correct directory and adds three bytes 20 0D 0A.  But if I use the
> system command
> in an Eu ".ex" file sending this:
> system("cmd echo. > "&dQuote&fullPath&dQuote,2) then it fails.  What is the
> actual
> difference between typing a command into the console, and sending the same
> command via a system()
> call?

When you run system() with ex.exe on XP, it seems to use 
some sort of DOS emulation mode, where long filenames don't work, 
and some commands do not have modern options. Someone pointed out 
for instance the the /s option on the rd command is rejected. 

Solution: use exwc.exe, or just avoid long filenames etc.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

3. Re: What is the reason for this?

Robert Craig wrote:
> 
> DB James wrote:
> > In the course of some experimentation in WinXP with sending commands to
> > cmd.exe, I
> > found this situation:
> > 
> > If I use RUN cmd to bring up the console for commands in NT-style OS, and
> > type in echo.
> > > "c:\long dir name\long file name.txt" it creates the file named "long file
> > > name.txt"
> > in the correct directory and adds three bytes 20 0D 0A.  But if I use the
> > system command
> > in an Eu ".ex" file sending this:
> > system("cmd echo. > "&dQuote&fullPath&dQuote,2) then it fails.  What is the
> > actual
> > difference between typing a command into the console, and sending the same
> > command via a system()
> > call?
> 
> When you run system() with ex.exe on XP, it seems to use 
> some sort of DOS emulation mode, where long filenames don't work, 
> and some commands do not have modern options. Someone pointed out 
> for instance that the /s option on the rd command is rejected. 
> 
> Solution: use exwc.exe, or just avoid long filenames etc.
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>
> 

Hi Robert,

Thanks for the reply.

I realized after I asked the question that probably few people know a definitive
answer to this because it may lie not in logic, but in the "psyche" pf Microsoft
(a scary topic).

I have found a way to create long filenames from an Eu ".ex" file, but (there
seems always to be a "but") it uses the double command of:
system(cmd /c fsutil file createnew "&dQuote&longFullPath&dQuotes, 2)

This works and bypasses the emulated DOS restriction on long file names, but it
insists on returning a message to stdout or stderr, anyway, to the screen.  It
doesn't help to use the quiet command to cmd.exe, which is /q.

Drat!  I don't want that message from fsutil.  Meanwhile I am wandering the
corridors of Ralf Brown's list like a wraith lost in Colossal Cave, and trying
other tricks....

--Quark

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

4. Re: What is the reason for this?

At 12:15 PM 8/16/05 -0700, you wrote:

>
>
>posted by: Robert Craig <rds at RapidEuphoria.com>
>
>DB James wrote:
> > In the course of some experimentation in WinXP with sending commands to 
> cmd.exe, I
> > found this situation:
> >
> > If I use RUN cmd to bring up the console for commands in NT-style OS, 
> and type in echo.
> > > "c:\long dir name\long file name.txt" it creates the file named "long 
> file name.txt"
> > in the correct directory and adds three bytes 20 0D 0A.  But if I use 
> the system command
> > in an Eu ".ex" file sending this:
> > system("cmd echo. > "&dQuote&fullPath&dQuote,2) then it fails.  What is 
> the actual
> > difference between typing a command into the console, and sending the 
> same command via a system()
> > call?

Quark:
         Use:  system("echo. > "&dQuote&fullPath&dQuote,2)
There's no need to call yet another instance of cmd.exe.  That's what 
"system" does.  I don't currently have XP to test this on but it works on 98.

>When you run system() with ex.exe on XP, it seems to use
>some sort of DOS emulation mode, where long filenames don't work,
>and some commands do not have modern options. Someone pointed out
>for instance the the /s option on the rd command is rejected.
>
>Solution: use exwc.exe, or just avoid long filenames etc.
>
>Regards,
>    Rob Craig
>    Rapid Deployment Software
>    http://www.RapidEuphoria.com

Rob:

         XP's DOS box is a modified earlier version of the command 
interpreter. I do not believe that it is emulated. If it were, I would 
expect a speed reduction which I have never noticed.  Type "ver" and it 
shows something like
... 5.something rather than 7.1 as it shows under 98.  I know for a fact 
that the Windows clipboard support (via dos interrupts) is *not* present in 
this version.  Possibly LFN support as well but I don't remember.  Juergen 
might know.

                 Bob

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

5. Re: What is the reason for this?

>From: DB James <guest at RapidEuphoria.com>
>Reply-To: EUforum at topica.com
>To: EUforum at topica.com
>Subject: Re: What is the reason for this?
>Date: Tue, 16 Aug 2005 13:49:39 -0700
>
>posted by: DB James <larch at adelphia.net>
>
>I have found a way to create long filenames from an Eu ".ex" file, but 
>(there seems always to be a "but") it uses the double command of:
>system(cmd /c fsutil file createnew "&dQuote&longFullPath&dQuotes, 2)
>

fsutil is its own program that exists in C:\Windows\System32 (or 
C:\WinNT\System32); you do not need to call cmd.

>This works and bypasses the emulated DOS restriction on long file names, 
>but it insists on returning a message to stdout or stderr, anyway, to the 
>screen.  It doesn't help to use the quiet command to cmd.exe, which is /q.
>

Try system("fsutil file createnew "&dQuote&longFullPath&dQuote&" 20 > nul", 
2)

>Drat!  I don't want that message from fsutil.  Meanwhile I am wandering the 
>corridors of Ralf Brown's list like a wraith lost in Colossal Cave, and 
>trying other tricks....
>
>--Quark
>

~[ WingZone ]~
http://wingzone.tripod.com/

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

6. Re: What is the reason for this?

Elliott S. de Andrade wrote:
> 
> >From: DB James <guest at RapidEuphoria.com>
> >Reply-To: EUforum at topica.com
> >To: EUforum at topica.com
> >Subject: Re: What is the reason for this?
> >Date: Tue, 16 Aug 2005 13:49:39 -0700
> >
> >posted by: DB James <larch at adelphia.net>
> >
> >I have found a way to create long filenames from an Eu ".ex" file, but 
> >(there seems always to be a "but") it uses the double command of:
> >system(cmd /c fsutil file createnew "&dQuote&longFullPath&dQuotes, 2)
> >
> 
> fsutil is its own program that exists in C:\Windows\System32 (or 
> C:\WinNT\System32); you do not need to call cmd.
> 
> >This works and bypasses the emulated DOS restriction on long file names, 
> >but it insists on returning a message to stdout or stderr, anyway, to the 
> >screen.  It doesn't help to use the quiet command to cmd.exe, which is /q.
> >
> 
> Try system("fsutil file createnew "&dQuote&longFullPath&dQuote&" 20 > nul", 
> 2)
> 
> >Drat!  I don't want that message from fsutil.  Meanwhile I am wandering the 
> >corridors of Ralf Brown's list like a wraith lost in Colossal Cave, and 
> >trying other tricks....
> >
> >--Quark
> >
> 
> ~[ WingZone ]~
> <a href="http://wingzone.tripod.com/">http://wingzone.tripod.com/</a>
> 
Hi Elliot,

Did you try that on your machine?  You were right about skipping the cmd /q /c
part, this worked to create the file:

system("fsutil file createnew "&dQ&fullPath&dQ&" 0 > nul",2)

However, it still proudly announced to the screen that it had done what it was
asked to do.

Thanks for the reply, it helped.

--Quark

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

7. Re: What is the reason for this?

Bob Elia wrote:

<snip>

>          XP's DOS box is a modified earlier version of the command
> interpreter. I do not believe that it is emulated. If it were, I would
> expect a speed reduction which I have never noticed.  Type "ver" and it
> shows something like
> ... 5.something rather than 7.1 as it shows under 98.  I know for a fact
> that the Windows clipboard support (via dos interrupts) is *not* present in
> this version.  Possibly LFN support as well but I don't remember.  Juergen
> might know.


Here are the results of some tests that I ran, when Eu 2.5 was at alpha
stage, concerning Euphoria's built-in functions (view with a fixed width
font). The first columns apply to programs interpreted by ex.exe, the
last column applies to programs that are translated and compiled by DJG.


                      +   =    LFN supported
                      -   = no LFN supported



                                  |     Euphoria     |
   Windows 98                     | 2.3 | 2.4 | 2.5a | 2.5a DJG
   ===============================+=====+=====+======+=========
   current_dir()                  |  -  |  -  |  -   |    +
   -------------------------------+-----+-----+------+---------
   chdir()                        |  -  |  -  |  -   |    +
   -------------------------------+-----+-----+------+---------
   dir()  argument w/o  wildcards |  +  |  -  |  +   |    +
          argument with wildcards |  -  |  -  |  -   |    -
          output                  |  -  |  -  |  -   |    +
   -------------------------------+-----+-----+------+---------
   open() existing file           |  +  |  +  |  +   |    +
          new file                |  -  |  -  |  -   |    +
   -------------------------------+-----+-----+------+---------




                                  |     Euphoria     |
   Windows XP home                | 2.3 | 2.4 | 2.5a | 2.5a DJG
   ===============================+=====+=====+======+=========
   current_dir()                  |  -  |  -  |  -   |    +
   -------------------------------+-----+-----+------+---------
   chdir()                        |  -  |  -  |  -   |    +
   -------------------------------+-----+-----+------+---------
   dir()  argument w/o  wildcards |  -  |  -  |  +   |    +
          argument with wildcards |  -  |  -  |  -   |    -
          output                  |  -  |  -  |  -   |    +
   -------------------------------+-----+-----+------+---------
   open() existing file           |  +  |  +  |  +   |    +
          new file                |  -  |  -  |  -   |    +
   -------------------------------+-----+-----+------+---------



Using my LFN.ZIP library, just write "+" in all fields. smile

Regards,
   Juergen

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

8. Re: What is the reason for this?

>From: DB James <guest at RapidEuphoria.com>
>Reply-To: EUforum at topica.com
>To: EUforum at topica.com
>Subject: Re: What is the reason for this?
>Date: Tue, 16 Aug 2005 21:15:45 -0700
>
>posted by: DB James <larch at adelphia.net>
>
>Hi Elliott,
>
>Did you try that on your machine?  You were right about skipping the cmd /q 
>/c part, this worked to create the file:
>
>system("fsutil file createnew "&dQ&fullPath&dQ&" 0 > nul",2)
>
>However, it still proudly announced to the screen that it had done what it 
>was asked to do.
>

Hmm, yes... It works on the command line, but not using system(). system() 
is supposed to allow command-line redirection but it doesn't seem to do it 
for >nul. Of course, you could use 0 instead of 2. Or, if you had to create 
two files, maybe you could redirect the output to a second file.

>Thanks for the reply, it helped.
>
>--Quark
>

~[ WingZone ]~
http://wingzone.tripod.com/

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

9. Re: What is the reason for this?

At 12:15 PM 8/16/05 -0700, you wrote:

>
>
>posted by: Robert Craig <rds at RapidEuphoria.com>
>
>DB James wrote:
> > In the course of some experimentation in WinXP with sending commands to
> cmd.exe, I
> > found this situation:
> >
> > If I use RUN cmd to bring up the console for commands in NT-style OS,
> and type in echo.
> > > "c:\long dir name\long file name.txt" it creates the file named "long
> file name.txt"
> > in the correct directory and adds three bytes 20 0D 0A.  But if I use
> the system command
> > in an Eu ".ex" file sending this:
> > system("cmd echo. > "&dQuote&fullPath&dQuote,2) then it fails.  What is
> the actual
> > difference between typing a command into the console, and sending the
> same command via a system()
> > call?

Quark:
         Use:  system("echo. > "&dQuote&fullPath&dQuote,2)
There's no need to call yet another instance of cmd.exe.  That's what
"system" does.  I don't currently have XP to test this on but it works on 
98.

>When you run system() with ex.exe on XP, it seems to use
>some sort of DOS emulation mode, where long filenames don't work,
>and some commands do not have modern options. Someone pointed out
>for instance the the /s option on the rd command is rejected.
>
>Solution: use exwc.exe, or just avoid long filenames etc.
>
>Regards,
>    Rob Craig
>    Rapid Deployment Software
>    http://www.RapidEuphoria.com

Rob:

         XP's DOS box is a modified earlier version of the command
interpreter. I do not believe that it is emulated. If it were, I would
expect a speed reduction which I have never noticed.  Type "ver" and it
shows something like
... 5.something rather than 7.1 as it shows under 98.  I know for a fact
that the Windows clipboard support (via dos interrupts) is *not* present in
this version.  Possibly LFN support as well but I don't remember.  Juergen
might know.

                 Bob
--------
REPLY
--------
Hi Bob,

Thanks for the reply.  Tried your suggestion, but it didn't work.  "Syntax 
error", because of the quotes and long file name.

This command works to create a long name directory:
system("cmd /q/c md "&dQ&fullPath&dQ,2)
But this command...:
system("md "&dQ&fullPath&dQ,2)
...does not work on my XP

As far as I can see, the normal effect of "system()" in an ".ex" file is to 
call command.com or to cause cmd.exe to invoke it.  At any rate, cmd.exe 
will act one way from its own commnd line, and another way when a command is 
sent from system() in an Eu ".ex" file.

I have been somewhat successful in bypassing the limitations of command.com 
by invoking cmd.exe explicitly and using its native capability.

Is DOS (it has no version -- it's called Windows DOS on my machine) 
emulated?  I don't know, but it is the shriveled remnant of its former self 
and runs under the control of cmd.exe, but oddly, cmd.exe is sort of a 
reincarnated DOS on steroids.  One can imagine former DOS types at Microsoft 
cruising happily around in the development process mostly within cmd.exe.

--Quark

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

10. Re: What is the reason for this?

At 07:40 AM 8/17/05 +0200, you wrote:

>
>
>Bob Elia wrote:
>
><snip>
>
> >          XP's DOS box is a modified earlier version of the command
> > interpreter. I do not believe that it is emulated. If it were, I would
> > expect a speed reduction which I have never noticed.  Type "ver" and it
> > shows something like
> > ... 5.something rather than 7.1 as it shows under 98.  I know for a fact
> > that the Windows clipboard support (via dos interrupts) is *not* present in
> > this version.  Possibly LFN support as well but I don't remember.  Juergen
> > might know.
>
>
>Here are the results of some tests that I ran, when Eu 2.5 was at alpha
>stage, concerning Euphoria's built-in functions (view with a fixed width
>font). The first columns apply to programs interpreted by ex.exe, the
>last column applies to programs that are translated and compiled by DJG.
>
>
>                       +   =    LFN supported
>                       -   = no LFN supported

<snip>

Ah yes, I remember these tables.  Thanks for posting them.

         Bob

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

Search



Quick Links

User menu

Not signed in.

Misc Menu