aGerman, thanks for your thoughtful and educating comments.
The method I presented in my last post is more suitable to what I am doing.
I stated in my first post that a subset from many lines of data is to be displayed
in a numbered list. This is for my never-ending development of a DOS batch file application that
draws from my personal collection of 18,000+ MIDI and MP3 music files. I use whole-word searching
to return a numbered list all all titles that have the word entered, or contiguous words, and also
an option to return either of two words, such as "street" or "streets". The numbered and
alphabetized list is presented in pages and has pauses between pages if the list is larger than my
defined page.
The application opens Windows Media player to play individual files or a playlist, and the
column of numbers identify which files are to be played or added to the editable playlist.
While viewing a list, one or more numbers can be entered as a single request, or a range,
such as 24-31 to perform some action for files #24 thru #31 on the list. This is a can-it-be-done?
challenge for me, and the answer is 'Yes, I'm getting there'.
Your example returns every available line which is not what I want to do. But your advice did help
me solve the issue of working with ! and & in the text. And through this post I learned how to generate
sequential numbers on the fly with this in a function from Yuri,
Set /a aCounter+=1
<nul Set /p ="%aCounter% "
which appears to echo to the console the line number without the linefeed, so that whatever
is immediately echoed after that , in my case a music file name, follows the line number.
I hope to be able to right-align the column of numbers to 5 places, which I can do with a character,
for example ....1, ....2, ...10, etc., with the number of leading spaces depending on the value
of aCounter So far I have not been able to keep leading spaces when substituted in another
variable that includes space followed by the value in aCounter.
Thanks again!