A Welcome Surprise with ⎕CMD

General APL language issues
Post Reply
User avatar
Dick Bowman
Posts: 235
Joined: Thu Jun 18, 2009 4:55 pm
Contact:

A Welcome Surprise with ⎕CMD

Post by Dick Bowman »

This was a surprise to me...

foo w
:Select w
:Case 0
⎕CMD'notepad.exe' ''
∘ ⍝ Stop after 2-element
:Case 1
⎕CMD'notepad.exe'
∘ ⍝ Stop after 1-element
:EndSelect

Doesn't seem to be documented. Wondering whether it's a bug or a feature. APL/W-64 12.1 Windows 7.

Apologies for timewasting if it is well-recognised behaviour.
Visit http://apl.dickbowman.com to read more from Dick Bowman
User avatar
kai
Posts: 141
Joined: Thu Jun 18, 2009 5:10 pm
Location: Hillesheim / Germany

Re: A Welcome Surprise with ⎕CMD

Post by kai »

I have no idea what "element" means; certainly not the options, because than 2 would be either 0 or 1 and 1 might actually be 1 - or 2.

I also wonder what exactly you are surprised about...
User avatar
Phil Last
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex

Re: A Welcome Surprise with ⎕CMD

Post by Phil Last »

foo 0 runs ⎕cmd with two elements and control passes back to APL immediately leaving notepad running concurrently.
foo 1 runs ⎕cmd with one element and waits for notepad to complete.

Yes, it is documented, or at least I knew about it so I must have gained that knowledge from somewhere.

Ah here we are:

Lang Ref - System functions - System Operations - Windows Command
Executing a windows Command (simple string)
Executing a Windows Program (two strings)
Post Reply