Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


File Counting and Item Counting Loop

Keywords:  file count counter  

Question:

How do I set up a file counter in a WinBatch Script?

Answer:

Code to replace the following DOS command:
>>> FOR %%J in (C:\*.EXE)  DO ECHO %%J
First you'll itemize all the EXE files in your root directory, and then do an itemcount on them.
List = FileItemize("C:\*.EXE")        ; get file list
FileCount=ItemCount( List, @TAB)      ; TAB for file list delimiter
for FileIndex = 1 to FileCount
         ThisFile= ItemExtract( FileIndex, List, @TAB)
         Message(FileCount, ThisFile)
next  

Article ID:   W14591
Filename:   File Counting and Item Counting Loop.txt