1.

Solve : Extract all filenames from folder?

Answer»

am trying to use batch to extract all the filenames from a directory & use them to print a menu as selections. I have listed a snip of code below, but only picks up 9 files as uses env. vars. Could someone advise me how to change this so as to get all files & have all var. avail to print. I have searched and tried many ways to use 'shift' but no success. I know it can be done with a 'for - do', but i'm from the early 80s in computers and I cannot get my head around this. I guess aging has put too much sticky stuff in my gray MATTER. Would appreciate the help as I am getting closer to divorce court every day.

@Echo off
cd %CD%\My Tutorial\CH04
dir /b /a:-d %1 %2 %3 %4 %5 %6 %7 %8 %9
pause

vandyoI'm not sure I UNDERSTAND exactly what you are trying to accomplish. To include all command line parameters in a command prompt under Win 2000 / XP, you can use %*, like:
Code: [Select]dir /b /a:-d %*I'm not sure I understand what you are trying to do with "menu selections". Can you try to explain?hi gary, thanks for your help

I tried your suggestion & it does work just like my example. I am moving some of my tuts from HD to cd/dvd & intend to add autorun menu to step thru the selections. The last menu Needs the lesson files (.mov), so that I can extract them from the dir & then print the menu formatting & the part numbers extracted. On selection the prog would run the selection & RETURN to the menu. I therefor need the filenames in a variable I can use. I really don't think 'dir' is the best way to go about it, but as I stated, I have a difficult time understanding the syntax of the for-do command.



Discussion

No Comment Found