@WORD[1-2,...] ?

May 20, 2008
9,274
62
Syracuse, NY, USA
This works fine; every line has a word 1:
Code:
v:\> do l in /p tasklist ( echo %@word[1,%l] )
[System
System
smss
csrss
*** SNIP ***
But when I ask for words 1-2 (or 1-9999) I don't even get word 1. What's happening here?
Code:
v:\> do l in /p tasklist ( echo %@word[1-2,%l] )
[System Process]
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
ECHO is OFF
taskhost          Task
dwm              DWM
explorer          Program
ECHO is OFF
winpm-32          Pegasus
powerpro          Physimem
OUTLOOK          RE:
ECHO is OFF
firefox          A
 
May 20, 2008
9,274
62
Syracuse, NY, USA
It seems that Frank, in another thread, found the culprit ... separators at the end of the string.
Code:
v:\> echo %@word[1-9999,PID scvhost]
scvhost
 
v:\> echo %@word[1-9999,PID scvhost ]
ECHO is OFF
 
v:\> echo %@word["-",1-9999,PID-scvhost]
scvhost
 
v:\> echo %@word["-",1-9999,PID-scvhost---]
ECHO is OFF